bjascob / pyinflect Goto Github PK
View Code? Open in Web Editor NEWA python module for word inflections designed for use with spaCy.
License: MIT License
A python module for word inflections designed for use with spaCy.
License: MIT License
There's a problem with the file encoding 'InflectionRules.py'
I just added this so that setup.py works
# -*- coding: utf-8 -*-
It would be great to be able to extend the infl.csv
and overrides.csv
files, e.g. a word is missing, so it can just be appended it to the file. So one way this could be possible, if I could specify paths to those files and keep them somewhere accessible and not untouchable in the library folder.
Currently, it's not exactly supported. When I tried to initialize manually the Inflections
object, I got an error. But maybe I'm just doing something wrong.
Code:
import spacy
from pyinflect import Inflections
nlp = spacy.load('en_core_web_sm')
inflections = Inflections('path/to/infl.csv', overrides_fn='path/to/overrides.csv')
Error:
ValueError: [E090] Extension 'inflect' already exists on Token. To overwrite the existing extension, set `force=True` on `Token.set_extension`.
Heya,
Like the new version! :)
Some quick suggestions:
To make it easier to use, I'd list all the valid POS tags and their meanings in the readme. Some people might not be familiar with PTB tags or what the package can generate.
If you have time, I also think it'd be nice if getAllInflections
returned a dictionary rather than a list: E.g. {"VB": ("eat"), "VBZ": ("eats"), ...}
. That way, we could also see all the forms that are available. It's true you can generally infer this from the position of the tuple in the list, but I think it'd be good to make it explicit.
With this in mind, I've attached the code I wrote previously to convert the infl.txt
into JSON format with POS tags: new_agid.zip
I think working from this file should also bypsas most of the other issues you have with overrides.
pos_type
argument optional in getAllInflections
. So you can specify V, A or N, but also leave it blank if you want to see all options;> getAllInflections("watch")
{"NN": ("watch"), "VB": ("watch"), ...}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.