regex-group

Replace all occurrences of a word with another specific word that must appear somewhere in the sentence before that word

Replace all occurrences of a word with another specific word that must appear somewhere in the sentence before that word Question: import re #example 1 input_text = "((PERSON)María Rosa) ((VERB)pasará) unos dias aqui, hay que ((VERB)mover) sus cosas viejas de aqui, ya que sus cosméticos ((VERB)estorban) si ((VERB)estan) tirados por aquí. ((PERSON)Cyntia) es una buena …

Total answers: 1

Why doesn't this regex capture group stop with the set condition and continue capturing until the end of the line?

Why doesn't this regex capture group stop with the set condition and continue capturing until the end of the line? Question: import re input_text = "((PL_ADVB)alrededor (NOUN)(del auto rojizo, algo grande y completamente veloz)). Luego dentro del baúl rápidamente abajo de una caja por sobre ello vimos una caña." #example input #place_reference = r"((?i:ws*)+)?" #place_reference …

Total answers: 1

Match words using this regex pattern, only if these words do not appear within a list of substrings

Match words using this regex pattern, only if these words do not appear within a list of substrings Question: import re input_text = "a áshgdhSdah saasas a corrEr, assasass a saltó sasass a sdssaa" #example list_verbs_in_this_input = ["serías", "serían", "sería", "ser", "es", "corré", "corrió", "corría", "correr", "saltó", "salta", "salto", "circularías", "circularía", "circulando", "circula", "consiste", "consistían", …

Total answers: 1

Why does this capture group capture a single character but not everything that the capture group covers?

Why does this capture group capture a single character but not everything that the capture group covers? Question: import re #input_example capture_where_capsule = "((PL_ADVB=’la gran biblioteca rápidamente y luego llegamos allí’)hacía)" list_all_adverbs_of_place = ["de allí", "de alli", "allí", "alli", "de allá", "de alla", "allá", "alla", "arriba", "abajo", "a dentro", "adentro", "dentro", "a fuera", "afuera", "fuera", …

Total answers: 1

Define capture regex for name recognition of composite people connected by a connector

Define capture regex for name recognition of composite people connected by a connector Question: import re def register_new_persons_names_to_identify_in_inputs(input_text): #Cases of compound human names: name_capture_pattern = r"(^[A-Z](?:w+)s*(?:del|des*el|de)s*^[A-Z](?:w+))?" regex_pattern = name_capture_pattern + r"s*(?i:ses*tratas*des*uns*nombre|(?:ser[íi]a|es)s*uns*nombre)" n0 = re.search(regex_pattern, input_text) #distingue entre mayusculas y minusculas if n0: word, = n0.groups() if(word == None or word == "" or word == …

Total answers: 1