clips / bratreader Goto Github PK
View Code? Open in Web Editor NEWPython code for reading Brat Repositories. Supports saving and reading from XML files for easy acces to annotations.
License: GNU General Public License v3.0
Python code for reading Brat Repositories. Supports saving and reading from XML files for easy acces to annotations.
License: GNU General Public License v3.0
I can't even import "repomodel"
>>> from bratreader.__init__ import __init__
>>> from bratreader.repomodel import RepoModel
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bratreader/repomodel.py", line 2, in <module>
from annotateddocument import AnnotatedDocument
File "bratreader/annotateddocument.py", line 3, in <module>
from lxml import etree
ImportError: No module named lxml
>>>
Maybe the fault is mine, I'm an absolute beginner in using such tools.
Any suggestions?
Hello,
I've tried to implement BreatReader script but I found the following issue:
File "data/examples/bratreader-master/bratreader/annotateddocument.py", line 83, in export_xml etree.ElementTree(document).write(f, pretty_print=True) File "src/lxml/etree.pyx", line 2050, in lxml.etree._ElementTree.write (src/lxml/etree.c:67074) File "src/lxml/serializer.pxi", line 731, in lxml.etree._tofilelike (src/lxml/etree.c:141736) File "src/lxml/etree.pyx", line 326, in lxml.etree._ExceptionContext._raise_if_stored (src/lxml/etree.c:13259) File "src/lxml/serializer.pxi", line 648, in lxml.etree._FilelikeWriter.write (src/lxml/etree.c:140363) **TypeError: write() argument must be str, not bytes**
How can I solve it?
thank you
Sisi
There's a little bug.. line 27 of annotationimporter.py should read
char_index += len(line)
adding 1 to the length caused my spans to shift with each sentence.. i.e by sentence 9, the indexes of all words were +9.
If i point RepoModel to the exact directory containing my .txt and .ann files, i get:
>>> r=RepoModel("/home/giuliano/Documenti/brat-v1.3_Crunchy_Frog/data/tesi")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bratreader/repomodel.py", line 48, in __init__
annotations, context = importpath("/".join([pathtorepo, path]))
File "bratreader/ann_filehandler.py", line 18, in importann
annotations = readannfile(pathtofile)
File "bratreader/ann_filehandler.py", line 209, in readannfile
return _evaluate_annotations(anndict)
File "bratreader/ann_filehandler.py", line 117, in _evaluate_annotations
annotationobjects = _createannotationobjects(annotations["T"])
File "bratreader/ann_filehandler.py", line 60, in _createannotationobjects
t, repr = t.split("\t")
ValueError: too many values to unpack
>>>
Instead pointing to brat folder seems to work, but the empty braces may suggest no document is found:
>>> r=RepoModel("/home/giuliano/Documenti/brat-v1.3_Crunchy_Frog")
>>> r.documents
{}
Moreover, what am I supposed to replace the key 001 in doc = r.documents[001]
with? File name? Or the key is automatically assign?
Ideally, we would like to present an actual sentences when users print sentence objects. Now, we print something like <sentence.Sentence at 0x10f6158d0>
. We used to print the string form of each sentence, but this caused problems with unicode in python2. If any word in a sentence contained unicode characters, the entire printing process would just break, which is undesirable.
This functionality needs to be re-added, without breaking python2 in the presence of unicode characters.
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.