def singular_to_plural(self): final_list = [] st = self.get_sentence() list_seperate_by_comma = st.split(",") # divide the sentence to list of strings by all the ',' for each in list_seperate_by_comma: if each[0] == " ": # prevent bug each = each[1:] m = each.split(" ") # split each sentence to list of words plural_list = [] for each in m: if en.is_noun(each): each = en.noun.plural(each) elif en.is_adjective(each): each = en.adjective.plural(each) elif en.is_connective(each): each = self.my_inflect.plural(each) elif en.is_persuasive(each): each = en.persuasive.plural(each) plural_list.append(each) plural_list = " ".join(plural_list) # convert each list to string final_list.append(plural_list) final_list = ", ".join(final_list) return final_list
def find_grammatical_kind(self): st = self.get_sentence() st = re.sub(",", "", st) # delete all commas result = [] m = st.split(" ") for each in m: flag = False if en.noun.is_emotion(each): result.append("emotion") flag = True elif en.is_connective(each): result.append("connective") flag = True elif en.is_verb(each): result.append("verb") flag = True elif en.is_adjective(each): result.append("adjective") flag = True elif en.is_noun(each): result.append("noun") flag = True elif en.is_persuasive(each): result.append("persuasive") flag = True elif en.is_number(each): result.append("number") flag = True if flag == False: result.append("unclear") return result
# for example HTML or XML. print(4, en.is_tag("</a>")) # Return True when the string is a HTML tag, # for example <a> or <body>. print(5, en.is_html_tag("</person>")) # COMMONSENSE ####################################################################### # Returns True if the given word expresses a basic emotion: # anger, disgust, fear, joy, sadness, surprise. print(6, en.is_basic_emotion("cheerful")) # Returns True if the given word is a magic word: # you, money, save, new, results, health, easy, ... print(7, en.is_persuasive("money")) # Returns True if the word is a connective: # nevertheless, whatever, secondly, ... # and words like I, the, own, him which have little semantical value. print(8, en.is_connective("but")) # NUMBERS ########################################################################### # Returns the ordinal of the given number, # 100 -> 100th, 3 -> 3rd # twenty-one -> twenty-first print(9, en.number.ordinal(100)) print(10, en.number.ordinal("twenty-one")) # Writes out the given number:
import en print en.is_basic_emotion("anxious") print en.is_persuasive("money") print en.noun.is_emotion("anger") print en.adjective.is_emotion("anxious", boolean=False) print en.is_noun("comptuer") print en.spelling.suggest("computer")[0] print en.verb.is_emotion("love", boolean=False) print en.verb.infinitive("announced") print en.verb.infinitive("dont") print en.is_verb("went") a=en.verb.infinitive("dont") print en.verb.is_emotion(a, boolean=False) print en.is_noun("people") print en.is_noun(en.noun.singular("adore")) print en.noun.lexname("book") print en.noun.lexname("music") print en.noun.lexname("water") print en.noun.lexname("fear") print en.noun.lexname("love") print en.noun.lexname("like") print en.noun.lexname("hate") print en.noun.lexname("overcome") print en.adverb.lexname("actually")