Did I find the right examples for you? yes no

All Samples(36)  |  Call(36)  |  Derive(0)  |  Import(0)
This function is the basic function of parsing
Input=list of sentences and beginning sentence list
Output=list of class Sentence

        def sentences_analyzer(sentences):
    """
    This function is the basic function of parsing
    Input=list of sentences and beginning sentence list
    Output=list of class Sentence
    """

    #init
    class_sentence_list = []
    nom_gr = []
    y = 0

    #We process all sentences of the list
    for i in sentences:
        if i:
            #We have to add punctuation if there is not
            if i[-1] not in ['.', '?', '!']:
                i = i + ['.']
            class_sentence_list = class_sentence_list + dispatching(i)

    #Add some information if there is an interjection
    for s in class_sentence_list:
        #If there is an interjection we have to take the nominal group
        if s.data_type == INTERJECTION:
            nom_gr = s.sn
            #If there is an imperative sentence, we put the nominal group of interjection in the subject
        if nom_gr != [] and s.data_type == IMPERATIVE:
            s.sn = s.sn + nom_gr

    #To simplify the interpretation, we have to perform some changes
    for k in class_sentence_list:
        #If subject is 'there', we change it by the object
        if k.sn != [] and k.sn[0].det == ['there']:
            k.sn = k.sv[0].d_obj
            k.sv[0].d_obj = []

        #If sentence is empty, we take off the verb
        if k.sv != [] and (k.sv[0].vrb_main == ['.'] or k.sv[0].vrb_main == ['?'] or k.sv[0].vrb_main == ['!']):
            k.sv[0].vrb_main = []
            if k.data_type == IMPERATIVE:
                k.data_type = STATEMENT

        #If we have imperative with verb 'see' => end
        if k.data_type == IMPERATIVE and \
                        k.sv[0].vrb_main == ['see'] and \
                        len(k.sv[0].d_obj) > 0 and \
                        k.sv[0].d_obj[0].noun == ['you']:
            k.data_type = END
            k.aim = ''
            k.sv = []
            k.sn = []

    return class_sentence_list
        


src/d/i/Dialogs-0.13/src/dialogs/parsing/parser.py   Dialogs(Download)
 
        #Do the actual grammatical parsing
        self._class_list = analyse_sentence.sentences_analyzer(self._sentence_list)
 
        return self._class_list

src/d/i/Dialogs-0.13/src/dialogs/sentence_test.py   Dialogs(Download)
    def check_valid(self, utterance, valid=True):
        sentence_list = preprocessing.process_sentence(utterance)
        sentences = analyse_sentence.sentences_analyzer(sentence_list)
 
        for s in sentences:
 
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
        flag = 'SUCCESS'
 
 
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
        flag = 'FAILURE'
 
 
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
        flag = 'SUCCESS'
 
 
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
        flag = 'FAILURE'
 

src/d/i/Dialogs-0.13/src/dialogs/interpretation/anaphora_test.py   Dialogs(Download)
        print('')
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
 
        print('#####################################')
        print('')
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
 
        print('#####################################')
        print('')
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
 
        print('#####################################')
        print('')
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
 
        print('#####################################')
        print('')
        sentence_list = preprocessing.process_sentence(utterance)
        class_list = analyse_sentence.sentences_analyzer(sentence_list)
 
        print('#####################################')