Package: japanese-verb-conjugator-v2
Japanese Verb ConjugatorJapanese Verb Conjugator is a Python library for conjugating Japanese verbs.
This fork is used to fix some Issues in the usage of the base package.
Changes will be recorded in CHANGELOG.mdWhat forms will Japanese Verb Conjugator conjugate?Japanese Verb Conjugator conjugates the following verb forms:plain formpolite form~te form~ta form~tari form~tara formconditional formvolitional formpotential formimperative formprovisional formcausative formpassive formJapanese Verb Conjugator conjugates verbs based onverb class,tense,formality, andpolarityparameters. Depending on the conjugation andverb class, the parameters for conjugation methods may vary.Examplegenerate_plain_formrequiresverb class,tense, andformalityparameters.generate_volitional_formrequiresverb class,tense, andpolarityparameters.Similarily the conjugations of the copula だ/です can be generated.InstallationUse the package managerpipto installjapanese-verb-conjugator-v2. If you want to installjapanese-verb-conjugator-v2and its dependencies in a virtual environment, first create and activiate a virtual environment. If you want to change the virtual environment name to someting other thanvenv, replace the secondvenvwith your desired name. Use that same name to replacevenvin the second command.python3-mvenvvenvsourcevenv/bin/activateIf you run into trouble, see thePython Virtual Environment tutorial.Method 1: PypiAfter installing and activating the virtual environment, run the following commands to installjapanese-verb-conjugator-v2and its dependencies.pipinstalljapanese-verb-conjugator-v2NotePip may display an error during installation that includes the following message.No matching distribution found for romkan (from JapaneseVerbConjugator)In this case, run the commandpip install romkanand then runpip install japanese-verb-conjugator-v2again.You should be good to go! See theUsagesection on how to get started using the library.Method 2: Clone this repositoryGo to the directory you want to clone this repository and run the following command.gitclonehttps://github.com/Bel-Shazzar/JapaneseVerbConjugator.gitTo install the Library use the following commandpipinstall.To run the library you should install the dependencies inrequirements.txt.pipinstall-rrequirements.txtYou should be good to go! See theUsagesection on how to get started using the library.UsageThe easiest to use method is the following:fromjapverbconj.constants.enumerated_typesimportVerbClassfromjapverbconj.verb_form_genimportgenerate_japanese_verb_by_strgenerate_japanese_verb_by_str("飲む",VerbClass.GODAN,"pla")# returns '飲むgenerate_japanese_verb_by_str("飲む",VerbClass.GODAN,"pla","past","neg")# returns '飲まなかった'generate_japanese_verb_by_str("飲む",VerbClass.GODAN,"pass","pol","neg")# returns '飲まれません'The strings after the VerbClass are built like this:The first string is required and must determine the desired BaseForm from the following.BaseForm.PLAIN="pla"BaseForm.POLITE="pol"BaseForm.TE="te"BaseForm.TA="ta"BaseForm.TARI="tari"BaseForm.TARI="tari"BaseForm.CONDITIONAL="cond"BaseForm.VOLITIONAL="vol"BaseForm.POTENTIAL="pot"BaseForm.IMPERATIVE="imp"BaseForm.PROVISIONAL="prov"BaseForm.CAUSATIVE="caus"BaseForm.PASSIVE="pass"The following arguments determine the specific conjugation, based on Formality, Tense and Polarity.Formality.PLAIN="pla"Formality.POLITE="pol"Tense.NONPAST="nonpast"Tense.PAST="past"Polarity.POSITIVE="pos"Polarity.NEGATIVE="neg"if an argument is left out, the first choice in the list above is assumedthe order of the arguments does not matterit is not possible to give arguments that are not present in the corresponding BaseForm, see following table for detailsBaseFormPossible argumentsBaseForm.PLAINBaseForm.POLITETense, PolarityBaseForm.TEBaseForm.TABaseForm.TARIBaseForm.TARABaseForm.CONDITIONALBaseForm.VOLITIONALBaseForm.POTENTIALBaseForm.IMPERATIVEBaseForm.PROVISIONALBaseForm.CAUSATIVEBaseForm.PASSIVEFormality, PolarityIf you prefer the more rigorous earlier version of calling individual methods for each form, you can still use that like this.fromjapverbconj.constants.enumerated_typesimportFormality,Polarity,Tense,VerbClassfromjapverbconj.verb_form_genimportJapaneseVerbFormGeneratorasjvfgjvfg.generate_plain_form("飲む",VerbClass.GODAN,Tense.NONPAST,Polarity.POSITIVE)# returns '飲む'jvfg.generate_plain_form("飲む",VerbClass.GODAN,Tense.NONPAST,Polarity.NEGATIVE)# returns '飲まない'The library will try to help validate the correctness of the verb by checking for invalid verb lengths, non-Japanese characters, and invalid verb endings.Limitation: this library cannot identify Chinese words with valid Japanese particle endings or nonexistent Japanese verbs.CopulaGeneration of copula forms works similarly:fromjapverbconj.verb_form_genimportgenerate_japanese_copula_by_strgenerate_japanese_copula_by_str("plain")# returns 'だ'generate_japanese_copula_by_str("pres","pol","neg")# returns 'ではないでしょう'The first argument is required and has to be one of the strings:CopulaForm.PLAIN="pla"CopulaForm.POLITE="pol"CopulaForm.TE="te"CopulaForm.CONDITIONAL="cond"CopulaForm.TARA="tara"CopulaForm.PRESUMPTIVE="pres"The following strings can be of the corresponding argumentsCopulaFormPossible argumentsCopulaForm.PLAINCopulaForm.POLITETense, PolarityCopulaForm.TECopulaForm.TARAFormalityCopulaForm.CONDITIONALCopulaForm.PRESUMPTIVEFormality, PolarityThe original way of calling individual methods also remains.fromjapverbconj.constants.enumerated_typesimportFormality,Polarity,Tense,VerbClassfromjapverbconj.verb_form_genimportJapaneseVerbFormGeneratorasjvfgjvfg.copula.generate_plain_form(Tense.NONPAST,Polarity.POSITIVE)# returns 'だ'jvfg.copula.generate_presumptive_form(Formality.POLITE,Polarity.NEGATIVE)# returns 'ではないでしょう'TestsThe coverage package is used to run the unittests. The configuration is defined in.coveragercTo run the tests, first install the testing requirementspipinstall-rtest/requirements.txtRun testsYou can run the tests like thiscoveragerun-munittestView coverage reportAfter running the tests with coverage you can show the coverage report like thiscoveragereportAlternatively you can generate an html representation like thiscoveragehtmlYou can open the html in a browser like thisopenhtmlcov/index.htmlContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.LicenseThis project uses a Python package namedromkan, which has a BSD license. This project therefore has aBSDlicense.