conjugate
v1.0.4
Published
Conjugate verbs correctly based on a pronoun
Downloads
28
Readme
conjugate
Conjugate verbs correctly based on a pronoun
Installation
npm install --save conjugate
Summary
Pass a pronoun and verb to conjugate
, and it will return the verb conjugated for that pronoun.
var conjugate = require('conjugate');
console.log(conjugate('he', 'run')); // 'runs'
Usage
Node
This is, for now, a one way conjugator. You must pass in the infinitive form of a verb (with or without "to") to get a correct conjugation. E.g.
conjugate('I', 'run');
or
conjugate('I', 'to run');
but not
conjugate('I', 'runs');
The latter would return "runs." This is probably not what you want. It would be nice for this library to, eventually, parse a verb in any form and conjugate it to the perspective desired (or even back to the infinitive). The problem is that this is much harder to do (if a verb ends in "s," is it an already conjugated verb like "runs" or simply a verb that ends in "s" like "pass"), and frankly, the module I wrote this for does not require this functionality.
I tried to find all the unusual verb forms I could, so many irregular verbs should still conjugate correctly, e.g.:
conjugate('he', 'do') // he does
conjugate('she', 'spy') // he spies
conjugate('it', 'buzz') // he buzzes
// and even
conjugate('I', 'be') // I am
but there are three caveats. First, it's not impossible that I missed cases, so please open pull requests if you find verbs that don't conjugate correctly. Second, some words don't conjugate (see defective verbs), but this module does not attempt to detect these or do anything special with them. For instance, conjugate('he', 'beware')
will return 'bewares,' which is not an actual verb. The problem is, what do you return if the word does not exist? Nothing? There's no good answer. Third, this module does not verify words against a dictionary or anything like that, so if you pass nonsense, it will be conjugated according the same parsing rules. E.g. conjugate('she', 'blergifo')
will return 'blergifoes.' I guess this could be considered a feature if you are wanting to make up your own words. ¯\(ツ)/¯
You can also make conjugate
return the pronoun and conjugated verb together by passing true
(for "append") as the third parameter.
conjugate('he', 'be', true) // he is
Browser
Serve either dist/conjugate.js or dist/conjugate.min.js however you serve javascript in your application, and then use window.conjugate
(or just conjugate
) to access the library on the client-side.
Contributing
Please see the contribution guidelines.