For a game like "Erudite", it is necessary to check whether there is a word in the dictionary composed by a player and whether it meets the requirements: nominative, singular.

Probably, it is enough to get a text file with words through the separator, and look for it in it. By the way, maybe there is a certain format more convenient for searching? Wood, sorting, everything?

The main question is how to expand the set of rules? Allow, for example, all cases, plural, verbs in all tenses.

    2 answers 2

    • In my opinion, you will hardly find any easy or medium difficulty method. Unless, list all possible options in the database or file.
    • With cases - easier. It would be possible to register the roots of words and separately possible suffixes, word endings, etc. But here is an ambush. Take for example the words "hashcode" and "horse". How to check the correctness of the written words, if in the dative case the first word is "hashcode U ", and the second is "con yu "? The question is rhetorical.
    • With verbs and their sometimes even sadder. Take: "go" and "go." In indefinite time (1st person) we get "I go" and "I go". Here, even the logic is not visible.

    Conclusion: " Russian language is great and mighty, but under PHP it is not sharpened ."

    PS By the way, there is another forum nearby (Russian) . It is possible that there can something sensible suggest.

    • in this case, the “easy” way would be to buy the spellchecking component in the lightest version, apparently. Yes, PHP is not a criterion at all. Most likely, it will be a JS or ActionScript solution on the client side. - Sergiks
    • one
      Found [such an option] ( speakrus.ru/dict/#lopatin ) - see "The spelling dictionary of Prof. Lopatin (2000) ", there is a full version for downloading to the database (2.0 MB) - Deonis
    • @sergiks, I think on the client side will not work. Only if you keep some cache. In reality, you probably should better find a dictionary of so-called "word forms" and look in it, without doing a word analysis. - avp 2:46 pm

    I think it is worthwhile to convert the dictionary into a separate SQL table for each part of speech:

    For example, for nouns there can be such fields:

    ID, Приставка, Корень, Суффикс, Окончание, Падеж, Род, Все слово, Одушевлённость, Число(единственное множественнно),Склонение, Нарицательность, Это же слово по умолчанию(ед число именительный падеж) 

    And then just make a SELECT to this table.

    Another question is how to get this table from a text file, you have to write a very nontrivial parser that takes into account the morphology.

    • one
      This is a bold way. With a file on the rock! - Sergiks