wetneb / pynif Goto Github PK
View Code? Open in Web Editor NEWA small Python library for NLP Interchange Format (NIF) for NER(D) systems
License: Apache License 2.0
A small Python library for NLP Interchange Format (NIF) for NER(D) systems
License: Apache License 2.0
On the current version of pynif, any URI for Contexts and Phrases is represented as a nif:OffsetBasedString
. It would be great to also cover the nif:ContextHashBasedString
.
I think it can be done ensuring backguard compatibility by adding an optional argument like:
Then, their respective def triples(self)
functions could have something like:
if self.hash_uri:
yield (self.uri, RDF.type, NIF.ContextHashBasedString)
else:
yield (self.uri, RDF.type, NIF.OffsetBasedString)
And both NIFContext and NIFPhrase def __init__
could be changed with something like this:
def __init__( ... , hash_uri = None):
slef.original_uri = uri if not hash_uri else hash_uri
I have a function that looks something like this:
def print_nif_contexts(filepath: str):
with open(filepath, "r", encoding="utf8") as file:
file_content = file.readlines()
nif_content = "".join(file_content)
nif_doc = NIFCollection.loads(nif_content)
for context in nif_doc.contexts:
print(context.uri)
The order of the contexts is random and differs from run to run.
I would expect the sort order to be the same as in the file from which the contexts are read.
Having the same order in every run would already help, but sorted(nif_doc.contexts)
is not supported (TypeError: '<' not supported between instances of 'NIFContext' and 'NIFContext'
).
Other than that I find the package really useful so far, thanks for making this opensource :)
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.