GithubHelp home page GithubHelp logo

jay_verb's Introduction

conjugator

Conjugator is a gem for conjugating Japanese verbs. The main driver is the Conjugator class. Instances should be initialized with Japanese verbs in plain form and include both kanji and hiragana, i.e.:

require "conjugator"

say = Conjugator("言う", "いう")

This will return a Conjugator instance, which will automatically convert the provided hiragana into Roman letters and process the verb. Note that the first kanji argument does not necessarily have to be written in Kanji. The library would still work given:

say = Conjugator("いう", "いう")
# Get the Roman-letter form of the verb by accessing the @romaji instance variable:
say.romaji # => "iu"

Note, however, that failing to provide both arguments will result in errors. The second argument MUST be written in hiragana for proper behavior.

When instantiating the verb, the type of verb will be resolved behind the scenes, which can be retrieved from the @part_of_speech instance variable. This enables the conjugator to conjugate the verb appropriately.

say = Conjugator("言う", "いう")
say.part_of_speech # => "v5u"

To find most common conjugations, access the @conjugations hash:

say = Conjugator("言う", "いう")
say.conjugations # => {:te_form=>"言って", :ta_form=>"言った", :polite_forms=>{:present=>"言います", :past=>"言いました", :present_negative=>"言いません", :past_negative=>"言いませんでした", :volitional=>"言いましょう", :te_form=>"言いまして"},
                 # :negative_plain_forms=>{:present=>"言わない", :past=>"言わなかった", :te_form=>"言わなくて"},
                 # :continuous_forms=>{:present_spoken=>"言ってる", :present_written=>"言っている", :present_polite=>"言っています", :present_polite_spoken=>"言ってます", :past_spoken=>"言ってた", :past_written=>"言っていた", :past_polite=>"言っていました", :past_polite_spoken=>"言ってました", :te_form_spoken=>"言ってて", :te_form_written=>"言っていて", :te_form_polite=>"言っていまして", :te_form_polite_spoken=>"言ってまして", :negative_te_form_spoken=>"言ってなくて", :negative_te_form_written=>"言っていなくて"},
                 # :prohibitive=>"言うな", :plain_present_potential=>"言える", :conditional=>"言えば", :imperative=>"言え", :volitional=>"言おう"}

The @hiragana_forms and @romaji_forms reflect these conjugations in hiragana and roman letters, respectively.

More forms can be accessed through the @passive_forms, @causative_forms, and @causative_passive_forms hashes. Check the @passive_forms_hiragana/@passive_forms_romaji, @causative_forms_hiragana/@causative_forms_romaji, and @causative_passive_forms_hiragana/@causative_passive_forms_romaji for the hiragana and roman letter versions.

A final note on naming conventions: the names ascribed to tenses and modes of verbs may not coincide with the names given in formal grammars. For example, continuous forms are of the format "te-form verb plus a conjugated 'iru' verb," and _spoken suffixes are added to denote that the "-i" in "iru" is being dropped as it generally would in speech, i.e.: "itteru" as opposed to the more enunciated "itte iru." The forms not dropping the "-i" in "iru" have been ascribed a _written suffix temporarily for lack of a better title. The standard "-masu" forms are described by polite_forms or denoted by _polite suffixes.

Future Additions & Amendments

The Japanese::Conjugator module has the functionality available to conjugate Japanese -i adjectives (adjectives ending in "い"); however, this gem does not currently offer an Adjective class to create adjective instances to work on. You can use the conjugator with adjectives if you have an instance with kanji, hiragana, and romaji properties along with a part_of_speech property that should be initialized to "adj-i". Running this through the conjugator should return the conjugated adjective.

jay_verb's People

Contributors

zkayser avatar searls avatar

Stargazers

Joesi D. avatar

Watchers

James Cloos avatar  avatar

Forkers

marosluuce

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.