I'm running a code that uses MeCab to split a specific part of speech in basic form, but the process isn't complete.
I've been waiting for about 5 hours, but the process is not over and I'm asking if there is a problem with the code.
The tsv file is about 500kb, so I don't think it is a serious cause. When using the same tsv file with other code, it works crisply.
Please make any changes to lighten the operation or point out any problems.
with open ("jurycomment2.tsv", mode = 'r', encoding = 'utf-8') as f: # reports.tsv contains word-of-mouth ID and word-of-mouth in a row separated by tabs reader = csv.reader (f, delimiter = "\ t") for report_id, report in reader: words =  node = mt.parseToNode (report) while node: if node.feature.split (",")  == u "noun": words.append (node.surface) elif node.feature.split (",")  == u "adjective": words.append (node.feature.split (",") ) elif node.feature.split (",")  == u "verb": words.append (node.feature.split (",") ) node = node.next stopword =  words2 = [token for token in words if token not in stopword] # words is a list of words in the sentence, tags specify the sentence ID reports.append (TaggedDocument (words = words2, tags = [report_id]))
Answer # 1
If there is a node that is neither a noun, a verb nor an adjective, node = node.next will not be called, so an infinite loop will occur.
I'm glad that it was solved, but if you look closely, it wouldn't be enough if there were non-verb nodes.
while node: if node.feature.split (",")  == u "noun": words.append (node.surface) elif node.feature.split (",")  == u "adjective": words.append (node.feature.split (",") ) elif node.feature.split (",")  == u "verb": words.append (node.feature.split (",") ) node = node.next
is not it.
- python - writing data to continuous excel using a text box
- image recognition using python beginner pyautogui is not possible
- i want to display an image using opencv from python
- i want to read an image file with python using pillow
- python - i want to define a function using a csv file
- i want to combine split images using cv2 (python)
- file reading and calculation using python
- python - when writing to a csv file, only the header is displayed
- i don't understand the description when using lambda for the key of the sort method of python
- to get the same output without using python dict
- [python] data preprocessing using pandas (deletion of multiple columns)
- i want to store data using a for statement using a table in html in python, but it is not displayed well
- python - i want to perform the same process for multiple xlsx files in a folder and save them with "_aggregate" at the
- python - i want to make a part of the file name a graph title and repeat the process
- python - how to display an image, make a selection, and process by selection
- python - when using pil, an error screen is displayed
- [python3] i want to enter the contents (name) of the qr code using a barcode reader
- python - probability prediction using multiple time series data
- i want to get a mac table using snmp in python
- python - sumy by specifying the maximum number of characters with sumy
- python - i want to morphologically analyze the extracted review comments, but i get an error saying'float'object has no attribut
- python - janome analyzer error
- python - i want to know how to resolve the error
- about the problem that python fails to determine the exact match of a string