Skip to content

c_Sentence Class Data Storage

Daniel edited this page Feb 24, 2019 · 2 revisions

One of the most used classes in Sophie6.1 is the c_Sentence.h class. This class collects and stores large amounts of data about the phrase or question submitted by the user. Almost every other class refers to this data to be able to do their work via Sets and Gets. Ultimately, all this data is saved in c_LongTermMemory and c_MemoryCells. It can be looked up because it is referenced by a sentence token, a unique integer created by the characters in the sentence, much like a word token.

Below is a list of variables and their descriptions;

    int    WordCount;                       // no. of words in sentence not counting punctuation  initialize to 0
    int    SubjectLocation;                 // from 0 to WordCount, -1 = subject not located
    int    WordTokens[30];                  // dog = 625 initialize to 0
    bool   isContraction[30];               // true / false  initialize to false  initialize to ""
    int    QuoteLocation[30];               // "can't" set to 3 for this, set to -1 for "dog"
    int    PluralWordFlag[30];              // u - undefined p - plural s - singular
    int    IndirectObjectLocation;          // usually the second noun
    int    AdverbLocation;                  // -1 means none
    int    AdjectiveLocation;               // -1 means none
    int    NounCount;                       // number of nouns in this sentence
    int    VerbLocation;                    // position of verb
    int    NamePointer;                     // position of the word name
    string Words[30];                       // Dog  i.e. original unedited word  initialize to ""
    string WordsLC[30];                     // Lower case dog  initialize to ""
    string SubWords[30];                    // replacement words, usually from subject stack
    string ContractionLongFormFirst[30];    // i.e.he's to he
    string ContractionLongFormSecond[30];   // i.e he's  to is
    string PluralRoot[30];                  // i.e. colors = color
    char   GenderClassInSentence[30];       // i.e m-male f-female n-neutral   initialize to u-undefined
    string OriginalString;                  // the whole unedited string  initialize to ""
    string Pattern;                         // i.e. dnvua  initialize to ""
    char   Punctuation;                     // !  initialize to null
    bool   HasPunctuation;                  // true / false initialize to false
    bool   HasPluralPronoun;                // true / false initialize to false
    bool   IsQuestion;                      // true / false initialize to false
    bool   HasContraction;                  // true / false initialize to false
    bool   HasGreetingsWord;                // true / false initialize to false
    bool   HasGenderReference;              // true / false initialize to false
    bool   HasBeenUnderstood;               // initialized to false, set externally
    bool   HasGenderDeterminer;             // the word 'gender' was used
    bool   IsPluralWord[30];                // indicates plural - read PluralRoot for base word
    char   WordType[30];                    // n-noun v-verb p-pronoun a-adjective d-determiner(the) r-subject
                                                 representative(it that) u-unknown c-connecting word(and)
                                                 C(cap) Contraction word
                                            // n-noun p-pronoun v-verb q-question word a-adjective r-subject
                                               replacement P(cap) ProperNoun i.e. name A(cap) Adverb D(cap)
                                               Direct Object d(LC) Indirect object
                                            // initialize to 'u' - undefined
    char   SecondaryType[30];               // same as WordType[] - future use
    char   AlternateType[30];               // same as WordType[] - future use

This list will continue to grow as data about the phrase or question is acquired, i.e. new flags or information is needed by other routines to process the original string.

A note about c_LongTermMemory: The entire class, c_Sentence.h is copied and stored in an unordered map that is referenced by Sentence Token. Another vector stores the sentence order referenced by sentence token, for recall of what, in order, was stated by the user.

Depreciated

A note about the fixed arrays:

All arrays will be converter to dynamic arrays like vector to prevent any over runs or out of bounds errors. This Wiki page will be updated when this is completed.

This list is current as of version V6.1.005.01 at 01/26/2019