GithubHelp home page GithubHelp logo

Comments (4)

bergr7 avatar bergr7 commented on June 27, 2024

same issue here:

python code/augment.py --input=data/train_original.txt --num_aug=15 --alpha_sr=0.1

Traceback (most recent call last):
File "code/augment.py", line 75, in
gen_eda(args.input, output, alpha_sr=alpha_sr, alpha_ri=alpha_ri, alpha_rs=alpha_rs, alpha_rd=alpha_rd, num_aug=num_aug)
File "code/augment.py", line 64, in gen_eda
aug_sentences = eda(sentence, alpha_sr=alpha_sr, alpha_ri=alpha_ri, alpha_rs=alpha_rs, p_rd=alpha_rd, num_aug=num_aug)
File "/Users/bernardogarcia/GitHub/eda_nlp/code/eda.py", line 194, in eda
a_words = random_insertion(words, n_ri)
File "/Users/bernardogarcia/GitHub/eda_nlp/code/eda.py", line 153, in random_insertion
add_word(new_words)
File "/Users/bernardogarcia/GitHub/eda_nlp/code/eda.py", line 160, in add_word
random_word = new_words[random.randint(0, len(new_words)-1)]
File "/Users/bernardogarcia/opt/anaconda3/envs/nlp-news_filter/lib/python3.7/random.py", line 222, in randint
return self.randrange(a, b+1)
File "/Users/bernardogarcia/opt/anaconda3/envs/nlp-news_filter/lib/python3.7/random.py", line 200, in randrange
raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,0, 0)

from eda_nlp.

msub0310 avatar msub0310 commented on June 27, 2024

In code/eda.py, the main function eda starts with below in line 175

sentence = get_only_chars(sentence)

get_only_chars function performs preprocessing to remove non-alphabetic characters from text. Therefore, if you input text data consisting of only non-alphabetic characters, len(words)-1 becomes -1 in the code below in line 117 and etc. and an error occurs.

rand_int = random.randint(0, len(words)-1)

If you input text data that consists only of non-alphabetic characters, you can avoid this error by modifying the get_only_chars function in line 45, so that the data is excluded from removal as follows.

if char in 'qwertyuiopasdfghjklzxcvbnm123456789(). ':

from eda_nlp.

zhoujiangfeng avatar zhoujiangfeng commented on June 27, 2024

i have same problem,big probability is your data problem. if you are sentence is null or particular token ,like "------".
check your data.

from eda_nlp.

shakiba-bakhtiari avatar shakiba-bakhtiari commented on June 27, 2024

I also have this problem, could this problem refers to dataset?
because my dataset has three columns but the dataset in this repository has two columns.
would you please help me.

from eda_nlp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.