After tweeter scraping, I am going to do 'morphological analysis'. But an error occurs.
"Process finished with exit code -1073740940 (0xC0000374)"
How do I fix the code? Please advise. Thank you for your advice.
from konlpy.tag import Twitter
from collections import Counter
def get_tags(text, ntags=50):
spliter = Twitter()
nouns = spliter.nouns(text)
count = Counter(nouns)
return_list = []
for n, c in count.most_common(ntags):
temp = {'tag': n, 'count': c}
return_list.append(temp)
return return_list
def main():
text_file_name = '11.txt'
noun_count = 30
output_file_name = '6767.txt'
open_text_file = open(text_file_name, 'r',-1,"utf-8")
text = open_text_file.read()
tags = get_tags(text, noun_count)
open_text_file.close()
open_output_file = open(output_file_name, 'w',-1,"utf-8")
for tag in tags:
noun = tag['tag']
count = tag['count']
open_output_file.write('{} {}\n'.format(noun, count))
open_output_file.close()
if __name__ == '__main__':
main()
User contributions licensed under CC BY-SA 3.0