Home>
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.
corresponding code
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 (",") [0] == u "noun":
words.append (node.surface)
elif node.feature.split (",") [0] == u "adjective":
words.append (node.feature.split (",") [6])
elif node.feature.split (",") [0] == u "verb":
words.append (node.feature.split (",") [6])
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
Related articles
- python - process without using the same formula twice
- i don't understand the exercises using python trigonometric functions
- python 3x - i want to get the nth array with an argument using python3 argparse
- (python) input () if time elapses without input, skip input () and move to the next process what can i do?
- please explain the function using the python dictionary
- parameter estimation using python's weighted least squares method (wls)
- parallel processing using python multiprocessingpool and multiprocessingqueue does not work well
- about external libraries when using multiple versions of python
- python - i want to separate by a specific word using the split function
- python - image recognition using cnn keras multiple inputs
- about batch change of file name using python
- python - i want to get the same result as assigning a variable and writing it directly in a function
- python 3x - processing to jump to the link destination using chrome driver in python
- python 3x - how to rename a folder created using jupyternotebook
- python - handling of 1d array data when using the predict function in keras
- python - error in image binarization using cv2adaptivethreshold function
- python - when using the cv2adaptivethreshold function in the binarization process of an image, an error occurs in medianblur and
- i want to adjust the execution result using the while statement in python as expected
- python - i want to put the image file path in a variable and open it using that variable
- i want to start the next process when the first process starts in python
Trends
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.
Appendix
I'm glad that it was solved, but if you look closely, it wouldn't be enough if there were non-verb nodes.
is not it.