aparrish / pycorpora

A simple Python interface for Darius Kazemi's Corpora Project.
MIT License
119 stars 24 forks source link

Allow hyphenated category names to be accessed as attributes #9

Closed bibliotechy closed 8 years ago

bibliotechy commented 8 years ago

Thanks for this library, it's tons of fun.

I noticed that categories with hyphenated names, like film-tv cannot be accessed as attributes since hyphens are not valid in attribute names. :(

This pr alters the attribute creation process, replacing hyphens with underscores for valid attribute names. It doesn't "underscorify" category names listed by get_category(), however, as that works as expected.

Wasn't sure if this was worth a readme update.

aparrish commented 8 years ago

looks good! (disregard the travis failure, I'll look into separately). now let's just hope that no one adds a new corpora category where the distinction between - and _ is important :)