Automatically pluralize/singularize sentence based #1115
jordan-erisman
started this conversation in
General
Replies: 1 comment
-
hey Jordan - yes and no! Compromise can change numbers, and inflect nouns, but it does assume all given text is correct and isn't a good candidate on its own, as a grammar-checker, or an ESL tool. The longer answer is that you can write any sort of matches, for these known sort of issues: if(doc.has('(1|one) #Plural')) {
doc.match('(1|one) [#Plural+]', 0).nouns().toSingular()
}
// ... this would catch, and repair the given type of issue. Mind you, some mal-formed english will trip-up the tagger, and it will try in vain to understand the sentence. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sorry if this isn't the correct usage of this library, or I missed an obvious way to do this. But I want to be able to automatically fix the pluralization of an entire sentence without knowing what it should be before hand.
Example:
1 dogs did not get fed. This is below the threshold: 2 dog
Should turn into:
1 dog did not get fed. This is above the threshold: 2 dogs
It can obviously get more complex, but we have a use case where we have sentence templates (not necessarily created by us), and want to drop in data points into them. Obviously the data returned should affect the sentence structure
I've attempted to use several functions with no luck.
Beta Was this translation helpful? Give feedback.
All reactions