preprocessor icon indicating copy to clipboard operation
preprocessor copied to clipboard

`reserved_words` attribute never gets filled, instead an originally undefined attribute `reserved` is created and filled instead.

Open rsyarif opened this issue 2 years ago • 1 comments

Describe the bug

When parsing, reserved_words attribute never gets filled, instead a new originally undefined attr reserved is created and filled instead.

To Reproduce

I printed out the following in processor/parse.py

print('a_parser_method:',a_parser_method)
print('attr:',attr)
print('items:',items)

if one looks at the original attributes, reserved is not defined

parse_res = ParseResult()
[x for x in dir(parse_res) if '__' not in x]
['emojis',
 'hashtags',
 'mentions',
 'numbers',
 'reserved_words',
 'smileys',
 'urls']

but once it goes through the parse function, a new attr reserved attr is created and filled instead of reserved_words

parse_obj = Parse()
[x for x in dir(parse_obj.parse('RT RT')) if '__' not in x] 
a_parser_method: parse_emojis
attr: emojis
items: None
a_parser_method: parse_hashtags
attr: hashtags
items: None
a_parser_method: parse_mentions
attr: mentions
items: None
a_parser_method: parse_numbers
attr: numbers
items: None
a_parser_method: parse_reserved_words
attr: reserved
items: [(0:2) => RT, (3:5) => RT]
a_parser_method: parse_smileys
attr: smileys
items: None
a_parser_method: parse_urls
attr: urls
items: None
['emojis',
 'hashtags',
 'mentions',
 'numbers',
 'reserved',
 'reserved_words',
 'smileys',
 'urls']

This is a harmless bug, but I thought I'd point it out anyway. It was a bit weird to find out that reserved_words always ending up empty no matter what.

rsyarif avatar Feb 25 '23 20:02 rsyarif

Good job

Wambua96 avatar Apr 08 '24 22:04 Wambua96