Exemplo n.º 1
0
def DoAction(text, action, options = {}):
    """
    do action by name
    """
    if action == "DoNothing":
        return text
    elif action == "TashkeelText":
        lastmark = options.get('lastmark', "0")
        return tashkeel_text(text, lastmark)
    elif action == "Tashkeel2":
        lastmark = options.get('lastmark', "0")    
        return tashkeel2(text, lastmark)
    elif action == "SpellCheck":
        # lastmark= options.get('lastmark', "0")    
        return spellcheck(text)
    elif action == "CompareTashkeel":
        return compare_tashkeel(text)
    elif action == "ReduceTashkeel":
        return reduced_tashkeel_text(text)
    if action == "Contibute":
        return text
    elif action == "StripHarakat":
        return araby.strip_tashkeel(text)
    elif action == "CsvToData":
        return csv_to_python_table(text)
    elif action == "Romanize":
        return romanize(text)
    elif action == "NumberToLetters":
        return number2letters(text)
    elif action == "LightStemmer":
        lastmark = options.get('lastmark', "0")
        return full_stemmer(text, lastmark)
    elif action == "Tokenize":
        return token_text(text)
    elif action == "Poetry":
        return justify_poetry(text)
    elif action == "Unshape":
        import pyarabic.unshape
        return pyarabic.unshape.unshaping_text(text)
    elif action == "Affixate":
        return affixate(text)
    elif action == "Normalize":
        return normalize(text)
    elif action == "Wordtag":
        return wordtag(text)
    elif action == "Inverse":
        return inverse(text)
    elif action == "Itemize":
        return itemize(text)
    elif action == "Tabulize":
        return tabulize(text)
    elif action == "Tabbing":
        return tabbing(text)
    elif action == "Language":
        return segment_language(text)
    elif action == "RandomText":
        return random_text()
    elif action == "showCollocations":
        return show_collocations(text)
    elif action == "extractEnteties":
        return extract_enteties(text)
    elif action == "extractNamed":
        return extractNamed(text)
    elif action == "chunk":
        return chunksplit(text)
    elif action == "bigrams":
        return bigrams(text)
    elif action == "extractNumbered":
        return extractNumbered(text)       
    else:

        return text
Exemplo n.º 2
0
def DoAction(text, action, options={}):
    """
    do action by name
    """
    if action == "DoNothing":
        return text
    elif action == "TashkeelText":
        lastmark = options.get('lastmark', "0")
        return tashkeel_text(text, lastmark)
    elif action == "Tashkeel2":
        lastmark = options.get('lastmark', "0")
        return tashkeel2(text, lastmark)
    elif action == "SpellCheck":
        # lastmark= options.get('lastmark', "0")
        return spellcheck(text)
    elif action == "CompareTashkeel":
        return compare_tashkeel(text)
    elif action == "ReduceTashkeel":
        return reduced_tashkeel_text(text)
    if action == "Contibute":
        return text
    elif action == "StripHarakat":
        return araby.strip_tashkeel(text)
    elif action == "CsvToData":
        return csv_to_python_table(text)
    elif action == "Romanize":
        return romanize(text)
    elif action == "NumberToLetters":
        return number2letters(text)
    elif action == "LightStemmer":
        lastmark = options.get('lastmark', "0")
        return full_stemmer(text, lastmark)
    elif action == "Tokenize":
        return token_text(text)
    elif action == "Poetry":
        return justify_poetry(text)
    elif action == "Unshape":
        import pyarabic.unshape
        return pyarabic.unshape.unshaping_text(text)
    elif action == "Affixate":
        return affixate(text)
    elif action == "Normalize":
        return normalize(text)
    elif action == "Wordtag":
        return wordtag(text)
    elif action == "Inverse":
        return inverse(text)
    elif action == "Itemize":
        return itemize(text)
    elif action == "Tabulize":
        return tabulize(text)
    elif action == "Tabbing":
        return tabbing(text)
    elif action == "Language":
        return segment_language(text)
    elif action == "RandomText":
        return random_text()
    elif action == "showCollocations":
        return show_collocations(text)
    elif action == "extractEnteties":
        return extract_enteties(text)
    elif action == "extractNamed":
        return extractNamed(text)
    elif action == "chunk":
        return chunksplit(text)
    elif action == "extractNumbered":
        return extractNumbered(text)
    else:

        return text