thanqurewelcome
не, не, оно и понятно, какой-то жалкий программист зарывшийся в своей конуре, не смог пройти мимо не оставив свой след.
thanqurewelcome
Внимание: для решения этой задачи достаточно того, что уже было рассмотрено на занятиях.
Какая-то жалкая пилотка, не смогла сделать то, что препод показывал и даже не сказала sergeekу спасибо
lines = ['Computational linguistics is an interdisciplinary field concerned with the statistical or rule-based modeling of natural language from a computational perspective.', 'Traditionally, computational linguistics was usually performed by computer scientists who had specialized in the application of computers to the processing of a natural language.', ' Computational linguists often work as members of interdisciplinary teams, including linguists (specifically trained in linguistics), language experts (persons with some level of ability in the languages relevant to a given project), and computer scientists.', ' In general, computational linguistics draws upon the involvement of linguists, computer scientists, experts in artificial intelligence, mathematicians, logicians, philosophers, cognitive scientists, cognitive psychologists, psycholinguists, anthropologists and neuroscientists, among others.', 'Computational linguistics has theoretical and applied components, where theoretical computational linguistics takes up issues in theoretical linguistics and cognitive science, and applied computational linguistics focuses on the practical outcome of modeling human language use.'] word = 'computer' for line in lines: if word in line.split(): print line
import re pattern = re.compile(r'\.{3}|[,!?;.:]|\b - \b') line = raw_input('Your text, please:') signs = set(pattern.findall(line)) line = [line] result_lst = [] for sign in signs: for word in line: result_lst.extend(word.split(sign)) result_lst = [] line = [item.strip() for item in result_lst if item != ''] for item in line: print item