{"id":16068141,"url":"https://github.com/ged/linguistics","last_synced_at":"2025-05-08T21:27:19.868Z","repository":{"id":1126880,"uuid":"1001326","full_name":"ged/linguistics","owner":"ged","description":"A generic, language-neutral framework for extending Ruby objects with linguistic methods. ","archived":false,"fork":false,"pushed_at":"2016-02-25T21:05:31.000Z","size":646,"stargazers_count":277,"open_issues_count":1,"forks_count":28,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-02-02T03:54:54.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://deveiate.org/projects/Linguistics","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ged.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.rdoc","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-10-18T22:37:16.000Z","updated_at":"2024-11-08T01:38:07.000Z","dependencies_parsed_at":"2022-08-16T12:10:13.435Z","dependency_job_id":null,"html_url":"https://github.com/ged/linguistics","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Flinguistics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Flinguistics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Flinguistics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ged%2Flinguistics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ged","download_url":"https://codeload.github.com/ged/linguistics/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238044095,"owners_count":19407128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T06:08:43.127Z","updated_at":"2025-02-10T02:10:10.556Z","avatar_url":"https://github.com/ged.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Linguistics\n\ndocs :: http://deveiate.org/code/linguistics\nproject :: https://bitbucket.org/ged/linguistics\ngithub :: https://github.com/ged/linguistics\n\n\n== Description\n\nLinguistics is a framework for building linguistic utilities for Ruby\nobjects in any language. It includes a generic language-independant\nfront end, a module for mapping language codes into language names, and\na module which contains various English-language utilities.\n\n\n== Usage\n\nThe Linguistics module comes with a language-independant mechanism for\nextending core Ruby classes with linguistic methods.\n\nIt consists of three parts: a core linguistics module which contains the\nclass-extension framework for languages, a generic inflector class that\nserves as an extension point for linguistic methods on Ruby objects, and\none or more language-specific modules which contain the actual\nlinguistic functions.\n\nThe module works by adding a single instance method for each language\nnamed after the language's two-letter code (or three-letter code, if no\ntwo-letter code is defined by ISO639) to various Ruby classes. This\nallows many language-specific methods to be added to objects without\ncluttering up the interface or risking collision between them, albeit at\nthe cost of three or four more characters per method invocation. For\nexample:\n\n    Linguistics.use( :en )\n    \"goose\".en.plural\n    # =\u003e \"geese\"\n\nIf you prefer monkeypatching (around 70) linguistics methods directly onto core\nclasses, you can do that by adding a 'monkeypatch' option to ::use:\n\n    Linguistics.use( :en, monkeypatch: true )\n    \"goose\".plural\n    # =\u003e \"geese\"\n\n=== Controlling Which Classes Get Extended\n\nIf you should wish to extend classes other than the ones in\n\u003ctt\u003eLinguistics::DEFAULT_EXT_CLASSES\u003c/tt\u003e, you have a few options.\n\nYou can modify the DEFAULT_EXT_CLASSES array directly (before you call\n::use, of course):\n\n    Linguistics::DEFAULT_EXT_CLASSES \u003c\u003c MyClass\n\nYou can also pass an Array of classes to .use:\n\n    Linguistics.use( :en, classes: [MyClass] )\n\nOr you can add language methods to classes via mixin:\n\n    class MyClass\n        include Linguistics::EN\n    end\n\nAll Linguistics methods use Ruby's casting mechanism, so at a minimum,\nyour classes should provide an implementation of #to_s that returns\nwords or phrases.\n\n\n=== Adding Language Modules\n\nTo add a new language to the framework, define a module that will act as\nthe top-level namespace for all your linguistic functions, and then\nregister it as being available, like so:\n\n    module Linguistics::TLH\n\n        # Add Klingon to the list of default languages\n        Linguistics.register_language( :tlh, self )\n\n    end\n\nThe first argument is either the two- or three-letter [ISO 639.2]\n(http://www.loc.gov/standards/iso639-2/php/code_list.php) language code\nfor the language you're registering.\n\nThe second is the container module itself.\n\nAfter you register your language, each class that Linguistics is told to\nextend will have a method for your language code/s:\n\n    irb\u003e Linguistics.use( :tlh, :classes =\u003e Object )\n    # =\u003e [Object]\n    irb\u003e Object.new.tlh\n    # =\u003e #\u003c(Klingon; tlhIngan-Hol-language inflector) for \u003cObject:0x402d9674\u003e \u003e\n\nIf you use RSpec 2, you can test out any API requirements of the module\nby requiring  'linguistics/languagebehavior' and adding a shared\nbehavior to your spec:\n\n    require 'rspec'\n    require 'linguistics/languagebehavior'\n\n    describe Linguistics::TLH do\n\n      it_should_behave_like \"a Linguistics language module\"\n\n      # ... any other specs for your module\n\n    end\n\nIf you wish to use the logging subsystem set up by Linguistics, you can\ndo so one of two ways: by logging to the logger directly:\n\n    Linguistics.log.debug \"Registering Klingon language extension\"\n\nor by mixing the `Linguistics::Loggable' module into your class/module,\nwhich will give you a 'log' method that prepends the object class on\neach log message so it's easy to filter out the ones you want:\n\n    require 'linguistics/mixins'\n    class Linguistics::TLH::Generator\n        include Linguistics::Loggable\n\n        def generate_it\n            self.log.debug \"starting generation...\"\n        end\n    end\n\n\n\n== English Language Module\n\nLinguistics comes with an English-language module; see the API\ndocumentation for Linguistics::EN for more information about it.\n\n\n== Authors\n\n* Michael Granger \u003cged@FaerieMUD.org\u003e\n* Martin Chase \u003cstillflame@FaerieMUD.org\u003e\n\n\n== Contributors\n\n* Robert Berry (bdigital on github) - English conjugation ported from\n  MorphAdorner\n\n\n== Requirements\n\n* Ruby \u003e= 1.9.3\n\nIt may work under earlier versions, but I'll only be testing it on 1.9.3\nor later.\n\n\n== Optional\n\nThe English-language module for Linguistics has support for a few other\noptional natural-language libraries:\n\nlinkparser[http://deveiate.org/projects/Ruby-LinkParser] ::\n  Ruby high-level interface to the CMU Link Grammar library\n\nwordnet[http://deveiate.org/projects/Ruby-WordNet] ::\n  Adds integration for the Ruby binding for the WordNet®\n  lexical refrence system.\n\n\n== Contributing\n\nYou can check out the current development source with Mercurial via its\n{project page}[http://deveiate.org/projects/Linguistics]. Or if you prefer\nGit, via {its Github mirror}[https://github.com/ged/linguistics].\n\nAfter checking out the source, run:\n\n    $ rake newb\n\nThis task will install any missing dependencies, run the tests/specs, and\ngenerate the API documentation.\n\n\n== License\n\nCopyright (c) 2003-2012, Michael Granger\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice,\n  this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the author/s, nor the names of the project's\n  contributors may be used to endorse or promote products derived from this\n  software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Flinguistics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fged%2Flinguistics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fged%2Flinguistics/lists"}