Skip to content

Can't import the tokenizer  #8

@RAHAMNIabdelkaderseifelislem

Description

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions