본문 바로가기

Python 배우기50

자연어 처리에 유용한 8가지 파이썬 라이브러리 자연어 처리(Natural Language Processing, NLP)를 풀어서 설명하면 “음성과 텍스트를 위한 AI”다. 음성 명령, 음성 및 텍스트 번역, 감정 분석, 텍스트 요약 등 언어 애플리케이션과 분석의 기반인 자연어 처리는 딥러닝을 통해 비약적으로 진화했다. ​ 파이썬 언어는 NLP를 포함한 모든 머신러닝 변형을 위한 편리한 프론트엔드를 제공한다. 사실 파이썬 생태계의 NLP는 선택하기가 난감할 정도로 풍부하다. ​ 여기서는 파이썬용으로 제공되는 각 NLP 라이브러리의 사용사례와 장단점, 전반적 인기도를 살펴본다. 참고로 라이브러리 가운데 일부는 다른 라이브러리가 제공하는 동일한 기능을 더 상위 수준에서 제공해 정확성 또는 성능을 약간 희생하는 대가로 사용 편의성을 더 높였다. 각자의 전문.. 2021. 1. 3.
class_definition.py class MyClass: variable = 777 # Assign value to a variable inside "MyClass". def foo(self): # we'll explain self parameter later in task 4 print("Hello from function foo") my_object = MyClass() # variable "my_object" holds an object of the class "MyClass" that contains the variable and the "foo" function my_object.foo() 산출물 (Output)Hello from function foo * 객체는 변수들과 함수들을 단일 엔터티로 결합합니다. 객체들은 클래스로.. 2016. 3. 11.
default_parameter.py def multiply_by(a, b=2): return a * b print(multiply_by(3, 47)) print(multiply_by(3)) # 패러미터 b에 대하여 기본 값을 사용하여 함수 호출하기 def hello(a, b="Jane"): # "hello" 함수에 패러미터를 추가하고, name parameter에 기본 값을 설정하기. print("Hello %s! My name is %s" % (a, b)) hello("PyCharm", "Jane") # subject 패러미터 "PyCharm" 및 이름 "Jane"을 가진 'hello' 함수 호출하기 hello("PyCharm") # subject 패러미터 "PyCharm" 및 이름에 대한 기본 값 "Jane"을 가진 'hello' 함수.. 2016. 3. 11.
param_args.py def foo(x): # x is a function parameter print("x = " + str(x)) foo(5) # pass 5 to foo(). Here 5 is an argument passed to function foo. def square(x): # Define a function that prints the square of the passed parameter. print(x ** 2) square(4) square(8) square(15) square(23) square(42) 산출물 (Output)x = 5 16 64 225 529 1764 * Function parameters are defined inside the parentheses (), following the f.. 2016. 3. 10.
functions.py def hello_world(): # function named my_function print("Hello, World!") for i in range(5): hello_world() # call function defined above 5 times print('I want to be a function') print('I want to be a function') print('I want to be a function') def fun(): # Define a function to replace duplicate lines in the file. print('I want to be a function') for i in range(3): fun() 산출물 (Output) Hello, World! H.. 2016. 3. 10.
continue_keyword.py for i in range(5): if i == 3: continue # skip the rest of the code inside loop for current i value print(i) for x in range(10): if x % 2 == 0: # Print only odd the numbers 1, 3, 5, 7, 9. continue # skip print(x) for this loop print(x) 산출물 (Output)0 1 2 4 1 3 5 7 9 * The 'continue' keyword is used to skip the rest of the code inside the loop for the currently executed loop and return to the "for".. 2016. 3. 10.