Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef agramtab_h
00006 #define agramtab_h
00007
00008
00009 #include "../common/utilit.h"
00010
00011
00012
00013 struct CAgramtabLine
00014 {
00015 CAgramtabLine (size_t SourceLineNo);
00016 BYTE m_PartOfSpeech;
00017 QWORD m_Grammems;
00018 size_t m_SourceLineNo;
00019 };
00020
00021
00022 typedef bool(*GrammemCompare)(const CAgramtabLine* l1, const CAgramtabLine* l2);
00023
00024 class CAgramtab {
00025 bool Read (const char *FileName);
00026 bool ReadAndCheck (const char * FileName);
00027
00028 public :
00029 bool m_bInited;
00030
00031 CAgramtab ();
00032 virtual ~CAgramtab ();
00033
00034
00035 virtual CAgramtabLine*& GetLine(size_t LineNo) = 0;
00036 virtual const CAgramtabLine* GetLine(size_t LineNo) const = 0;
00037 virtual size_t GetMaxGrmCount() const = 0;
00038 virtual BYTE GetPartOfSpeechesCount() const = 0;
00039 virtual const char* GetPartOfSpeechStr(BYTE i) const = 0;
00040 virtual size_t GetGrammemsCount() const = 0;
00041 virtual const char* GetGrammemStr(size_t i) const = 0;
00042 virtual size_t s2i(const char * s ) const = 0;
00043 virtual string i2s(WORD i) const = 0;
00044 virtual const char* GetRegistryString() const = 0;
00045 virtual long GetClauseTypeByName(const char* TypeName) const = 0;
00046 virtual const char* GetClauseNameByType(long type) const = 0;
00047 virtual bool GleicheSubjectPredicate(const char* gram_code1, const char* gram_code2) const = 0;
00048 virtual bool GleicheGenderNumber(const char* gram_code1, const char* gram_code2) const = 0;
00049 virtual const size_t GetClauseTypesCount() const = 0;
00050 virtual bool ProcessPOSAndGrammems (const char* tab_str, BYTE& PartOfSpeech, QWORD& grammems) const;
00051
00052
00053
00054
00055
00056
00057
00058
00059 virtual bool IsStrongClauseRoot(const DWORD Poses) const = 0;
00060 virtual bool is_month (const char* lemma) const = 0;
00061 virtual bool is_small_number (const char* lemma) const = 0;
00062 virtual bool IsMorphNoun (size_t Poses) const = 0;
00063 virtual bool is_morph_adj (size_t poses) const = 0;
00064 virtual bool is_morph_participle (size_t poses) const = 0;
00065 virtual bool is_morph_pronoun (size_t poses) const = 0;
00066 virtual bool is_morph_pronoun_adjective(size_t poses) const = 0;
00067 virtual bool is_left_noun_modifier (size_t Poses, QWORD grammems) const = 0;
00068 virtual bool is_numeral (size_t poses) const = 0;
00069 virtual bool is_verb_form (size_t poses) const = 0;
00070 virtual bool is_infinitive(size_t poses) const = 0;
00071 virtual bool is_morph_predk(size_t poses) const = 0;
00072 virtual bool is_morph_adv(size_t poses) const = 0;
00073 virtual bool is_morph_personal_pronoun (size_t poses, QWORD grammems) const = 0;
00074 virtual bool is_morph_article(size_t poses) const = 0;
00075
00076 virtual bool IsSimpleParticle(const char* lemma, size_t poses) const = 0;
00077 virtual bool IsSynNoun(size_t Poses, const char* Lemma) const = 0;
00078 virtual bool IsStandardParamAbbr (const char* WordStrUpper) const = 0;
00079
00080 virtual bool GleicheCase(const char* gram_code_noun, const char* gram_code_adj) const = 0;
00081 virtual bool GleicheCaseNumber(const char* gram_code1, const char* gram_code2) const = 0;
00082 virtual QWORD GleicheGenderNumberCase(const char* common_gram_code_noun, const char* gram_code_noun, const char* gram_code_adj) const = 0;
00083
00084 bool LoadFromRegistry ();
00085 bool LoadFromRegistryAndCheck ();
00086 int AreEqualPartOfSpeech (char *grm1, char* grm2) ;
00087 bool ProcessPOSAndGrammemsIfCan (const char* tab_str, BYTE* PartOfSpeech, QWORD* grammems) const;
00088 char* grammems_to_str (QWORD grammems, char* out_buf) const;
00089 bool FindGrammems (const char* gram_codes, QWORD grammems) const;
00090 bool GetGramCodeByGrammemsAndPartofSpeechIfCan(BYTE Pos, QWORD grammems, string& gramcodes) const;
00091 bool GetPartOfSpeechAndGrammems(const BYTE* AnCodes, DWORD& Poses, QWORD& Grammems) const;
00092 string GrammemsToStr(QWORD grammems) const;
00093 string GetTabStringByGramCode(const char* gram_code) const;
00094 BYTE GetPartOfSpeech(const char* gram_code) const;
00095
00096 QWORD GetAllGrammems(const char *gram_code) const;
00097 size_t GetSourceLineNo(const char* gram_code) const;
00098 QWORD GetAllGrammemsThatContains(const char *gram_code) const;
00099 bool GetGrammems(const char* gram_code, QWORD& grammems) const;
00100 BYTE GetFirstPartOfSpeech(const DWORD poses) const;
00101
00102 string GetAllPossibleAncodes(BYTE pos, QWORD grammems) const;
00103 QWORD Gleiche (GrammemCompare CompareFunc, const char* gram_codes1, const char* gram_codes2) const;
00104 string GleicheAncode1 (GrammemCompare CompareFunc, const char* gram_codes1, const char* gram_codes2) const;
00105
00106
00107
00108 };
00109
00110
00111
00112 #endif