자연어처리
-
Attention Is All You Need (Transformer) 논문 설명자연어처리 2024. 3. 6. 13:43
https://arxiv.org/abs/1706.03762 Attention Is All You NeedThe dominant sequence transduction models are based on complex recurrent or convolutional neural networks in an encoder-decoder configuration. The best performing models also connect the encoder and decoder through an attention mechanism. We propose a newarxiv.org 1. RNN과 LSTMSeq2Seq 문제를 풀기 위해서는 input의 길이와는 상관 없이 입력을 받을 수 있..
-
[NLP-tensorflow] Training an AI to create poetry (NLP Zero to Hero - Part 6)자연어처리 2022. 6. 8. 16:40
https://www.youtube.com/watch?v=ZMudJXhsUpY&list=PLQY2H8rRoyvzDbLUZkbudP-MFQZwNmU4S&index=6 tokenizer = Tokenizer() data = "In the town of Athy one Jeremy Lanigan \n Battered away ... ..." corpus = data.lower().split("\n") tokenizer.fit_on_texts(corpus) total_words = len(tokenizer.word_index) + 1 앞서, classification을 했을 때와는 다르게 문장을 생성하는 것이므로 train, test set을 분리하지 않는다. input_sequences = [] # empty..
-
[NLP-tensorflow] Long Short Term Memory for NLP자연어처리 2022. 6. 8. 15:34
https://www.youtube.com/watch?v=A9QVYOBjZdY&list=PLQY2H8rRoyvzDbLUZkbudP-MFQZwNmU4S&index=5 Today has a beautiful blue 같은 문장이 있을 때 괄호 안의 단어를 예측한다고 하자. 우리는 쉽게 괄호 안에 "sky"라는 단어가 올것이라는 것을 알 수 있다. I lived in Ireland, so at school they made me learn how to speak 위의 문장과 같은 경우에는 어떨까? 정답은 'Gaelic'이다. 정답을 결정하는 키워드는 무엇일까? 바로 Ireland이다. 하지만 Ireland와 Gaelic은 서로 멀리 떨어져있기 때문에 RNN을 사용하는 경우 정답을 얻어내는 것이 어려워질 수 있..
-
[NLP-tensorflow] ML with Recurrent Neural Networks자연어처리 2022. 6. 8. 15:19
https://www.youtube.com/watch?v=OuYtk9Ymut4&list=PLQY2H8rRoyvzDbLUZkbudP-MFQZwNmU4S&index=4 Generating Text? Recurrent Neural Networks (순환 신경망 RNN) takes sequence of data into account when it's learning A numeric value can recur throughout the life https://ko.wikipedia.org/wiki/순환_신경망 순환 신경망 - 위키백과, 우리 모두의 백과사전 순환 신경망(Recurrent neural network, RNN)은 인공 신경망의 한 종류로, 유닛간의 연결이 순환적 구조를 갖는 특징을 갖고 있다. ..
-
[NLP-tensorflow] Part 3 Training a model to recognize sentiment in text자연어처리 2022. 6. 6. 15:18
https://www.youtube.com/watch?v=Y_hzMnRXjhI&list=PLQY2H8rRoyvzDbLUZkbudP-MFQZwNmU4S&index=3 문장이 sarcasitic 한지 안한지 classifer로 분류. is_sarcastic: 1-sarcastic, 0-otherwise headline: the headline of the news article article_link: link to the original news article. Useful in collecting supplementart data 파일이 JSON 형식이므로 파이썬 list 형태로 바꾸어주어야함 import json with open("sarcasm.json", 'r') as f: # file open a..
-
[NLP-tensorflow] Part 2 Turning sentences into data자연어처리 2022. 6. 6. 14:27
https://www.youtube.com/watch?v=r9QjkdSJZ2g&list=PLQY2H8rRoyvzDbLUZkbudP-MFQZwNmU4S&index=2 Creating sequences of numbers from your sentences and using tools to process them to make them ready for teaching neural networks from tensorflow.keras.preprocessing.text import Tokenizer sentences = [ 'I love my dog', 'I love my cat', 'You love my dog', 'Do you think my dog is amazing?' ] tokenizer = Tok..
-
[NLP-Tensorflow] Part 1 Tokenization자연어처리 2022. 6. 6. 13:09
https://www.youtube.com/watch?v=fNxaJsNG3-s&list=PLQY2H8rRoyvzDbLUZkbudP-MFQZwNmU4S How to process words in a way that a computer can process them. 단어들을 컴퓨터가 처리할 수 있는 모양으로 어떻게 처리할 것인가? Tokenization 토큰화 단어에 포함된 각 문자를 encoding scheme을 통해 숫자로 표현할 수 있다. 하지만 밑의 두 단어처럼 구성한는 문자는 동일하지만 순서만 다른 경우에는 다른 뜻을 표현하기 어려울 수 있다. 따라서 단어에 있는 각 문자를 인코딩하기 보다는 각 단어를 인코딩하는 방법을 사용할 수 있다. 예를 들어, "I love my dog"라는 문장이 있을 때..