tkseem icon indicating copy to clipboard operation
tkseem copied to clipboard

Can't import the tokenizer

Open RAHAMNIabdelkaderseifelislem opened this issue 2 years ago • 0 comments

when I tried to launch the code

import tkseem as tk
import csv

# initialize the tokenizer
tokenizer = tk.WordTokenizer()
tokenizer.train('data.txt')
# open the csv file and read the text data
with open('../uploads/tweets-ar.csv', mode='r', encoding='utf-8') as csv_file:
    csv_reader = csv.reader(csv_file)
    for row in csv_reader:
        text = row[0]
        # tokenize the text using tkseem
        tokens = tokenizer.tokenize(text)
        print(tokens)

i got this error

File "pathtomycode\tokenize.py", line 5, in <module>
    tokenizer = tk.WordTokenizer()
AttributeError: partially initialized module 'tkseem' has no attribute 'WordTokenizer' (most likely due to a circular import)