inflection

Good inflection library for PHP? [closed]

a 夏天 提交于 2020-01-01 09:59:06
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm looking for a good inflection (or well, a library that can turn plural into singular and vice verse - which a kind of inflection)

How to turn plural words singular?

半世苍凉 提交于 2019-12-18 10:53:25
问题 I'm preparing some table names for an ORM, and I want to turn plural table names into single entity names. My only problem is finding an algorithm that does it reliably. Here's what I'm doing right now: If a word ends with -ies , I replace the ending with -y If a word ends with -es , I remove this ending. This doesn't always work however - for example, it replaces Types with Typ Otherwise, I just remove the trailing -s Does anyone know of a better algorithm? 回答1: Those are all general rules

How to get inflections for a word using Wordnet

ぃ、小莉子 提交于 2019-12-10 01:45:52
问题 I want to get inflectional forms for a word using Wordnet. E.g. If the word is make , then its inflections are made, makes, making I tried all the options of the wn command but I did not get the inflections for a word. Any idea how to get these? 回答1: I am not sure wordnet was intended to inflect words. Just found this little writeup about how WordNet(R) makes use of the Morphy algorithm to make a morphological determination of the head term associated with an inflected form https://github.com

rails 3.1 inflection problem

别来无恙 提交于 2019-12-07 13:11:30
问题 I have a Rails 3.1 app with the following 2 models class Listing < ActiveRecord::Base has_many :listing_saves end class Team < ActiveRecord::Base has_many :listing_saves has_many :saved_listings, through: :listing_saves, source: 'listing' end The Join model looks like this class ListingSave < ActiveRecord::Base belongs_to :team belongs_to :listing end Mow I think that there is an inflection problem because whenever I try to run my tests I get the following error (this is an example of an

Why does CakePHP use different plural/singular naming conventions?

ぐ巨炮叔叔 提交于 2019-12-06 03:49:36
问题 Can somebody perhaps explain here why on earth CakePHP has a convention of using plural names for db tables and controllers and singular for models? Why not always use singular terms, or always plural? For me it seems confusing to always have to think "now do I use plural or singular here?" (Or is there an easy way to remember??) And then you have the join-tables that use a combination of both! I assume there's a good reason somewhere, but just have not come across it. (I really hope it's not

Good inflection library for PHP? [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 07:29:10
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm looking for a good inflection (or well, a library that can turn plural into singular and vice verse - which a kind of inflection) library for PHP, it could be a part of some current framework or a stand alone library the only

Why does CakePHP use different plural/singular naming conventions?

六眼飞鱼酱① 提交于 2019-12-04 06:59:13
Can somebody perhaps explain here why on earth CakePHP has a convention of using plural names for db tables and controllers and singular for models? Why not always use singular terms, or always plural? For me it seems confusing to always have to think "now do I use plural or singular here?" (Or is there an easy way to remember??) And then you have the join-tables that use a combination of both! I assume there's a good reason somewhere, but just have not come across it. (I really hope it's not just because Ruby-on-Rails works that way.) Simon. CakePHP Conventions CakePHP’s conventions have been

Issue with custom inflections in Ruby on Rails 3.0.3

落花浮王杯 提交于 2019-12-02 17:04:18
问题 I have a model called produccion_alternativa . I added a new inflection rule in config/initializers/inflections.rb, like this: inflect.irregular('produccion_alternativa', 'producciones_alternativas') I have other model called productor that has a relation with produccion_alternativa : class Productor < ActiveRecord::Base has_many :producciones_alternativas class ProduccionAlternativa < ActiveRecord::Base belongs_to :productor When a I try to get all the producciones_alternativas for a

Issue with custom inflections in Ruby on Rails 3.0.3

不问归期 提交于 2019-12-02 11:49:21
I have a model called produccion_alternativa . I added a new inflection rule in config/initializers/inflections.rb, like this: inflect.irregular('produccion_alternativa', 'producciones_alternativas') I have other model called productor that has a relation with produccion_alternativa : class Productor < ActiveRecord::Base has_many :producciones_alternativas class ProduccionAlternativa < ActiveRecord::Base belongs_to :productor When a I try to get all the producciones_alternativas for a productor , I get this error: irb(main):010:0> Productor.first.producciones_alternativas NameError:

Ruby on Rails Inflection Issue

社会主义新天地 提交于 2019-12-01 20:52:20
问题 I am using Ruby on Rails to create a website for a game I play. I have a User model and a Starbase model. The relationship I am trying to setup is like so class User < ActiveRecord::Base has_many :starbases end class Starbase < ActiveRecord::Base belongs_to :user end However when I open script/console and try to access the users starbases it gives me an error: NameError: uninitialized constant User::Starbasis . It seems as if it is a problem with inflection and rails is not pluralizing