Уведомления

Группа в Telegram: @pythonsu

#1 Окт. 3, 2013 16:49:14

thanqurewelcome
Зарегистрирован: 2013-10-03
Сообщения: 5
Репутация: +  0  -
Профиль  

-

-

Отредактировано thanqurewelcome (Сен. 6, 2017 22:46:07)

Офлайн

#2 Окт. 3, 2013 16:50:57

thanqurewelcome
Зарегистрирован: 2013-10-03
Сообщения: 5
Репутация: +  0  -
Профиль  

-



-

Отредактировано thanqurewelcome (Окт. 10, 2013 22:31:21)

Офлайн

#3 Окт. 3, 2013 16:51:10

thanqurewelcome
Зарегистрирован: 2013-10-03
Сообщения: 5
Репутация: +  0  -
Профиль  

-

-

Отредактировано thanqurewelcome (Сен. 6, 2017 22:46:18)

Офлайн

#4 Окт. 3, 2013 17:04:35

Budulianin
От:
Зарегистрирован: 2011-10-18
Сообщения: 1218
Репутация: +  33  -
Профиль   Отправить e-mail  

-

thanqurewelcome
Напишите код, который будет рещать следующую задачу
thanqurewelcome
новичку-девушке
: D



Офлайн

#5 Окт. 3, 2013 17:09:18

sergeek
Зарегистрирован: 2012-06-26
Сообщения: 470
Репутация: +  43  -
Профиль   Отправить e-mail  

-

Неужели на филфаке стали заставлять программировать?

Офлайн

#6 Окт. 3, 2013 18:57:20

Singularity
Зарегистрирован: 2011-07-28
Сообщения: 1387
Репутация: +  75  -
Профиль   Отправить e-mail  

-

thanqurewelcome
Внимание: для решения этой задачи достаточно того, что уже было рассмотрено на занятиях.
и какие могут быть вопросы ?

Офлайн

#7 Окт. 3, 2013 19:22:53

sergeek
Зарегистрирован: 2012-06-26
Сообщения: 470
Репутация: +  43  -
Профиль   Отправить e-mail  

-

import re
sentences = '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'
regex = re.compile('(?:^|\W){}(?:\W|$)'.format(word), re.I)
for sentence in sentences:
    if regex.search(sentence):
        print(sentence)

Офлайн

#8 Окт. 3, 2013 19:39:29

Singularity
Зарегистрирован: 2011-07-28
Сообщения: 1387
Репутация: +  75  -
Профиль   Отправить e-mail  

-

sergeek
чего ты всяким трансам помогаешь ?

Офлайн

#9 Окт. 3, 2013 19:45:34

sergeek
Зарегистрирован: 2012-06-26
Сообщения: 470
Репутация: +  43  -
Профиль   Отправить e-mail  

-

Singularity
sergeekчего ты всяким трансам помогаешь ?
не знаю, мне нравится
2
import re
 
mark_spec = {
    'ellipsis '         : ' \.{3} ?'
    ,'dot'              : '\. ?'
    ,'comma'            : ', ?'
    ,'exclamation mark' : '! ?'
    ,'question mark'    : '\? ?'
    ,'colon'            : ': '
    ,'dash'             : ' - ?'
}
 
regex = re.compile('(?:{})+'.format('|'.join(mark_spec.values())))
 
def split(text):
    for name, mark in mark_spec.items():
        if re.search(mark, text):
            print('...see {} here'.format(name))
            
    print('The segments of your text are:')    
    for s in re.split(regex, text):
        print(s)
    
def main():
    while True:
        split(input('Your text, please: ').replace('"',''))
  
main()

Офлайн

#10 Окт. 3, 2013 22:09:06

thanqurewelcome
Зарегистрирован: 2013-10-03
Сообщения: 5
Репутация: +  0  -
Профиль  

-

-

Отредактировано thanqurewelcome (Окт. 10, 2013 22:30:38)

Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version