GithubHelp home page GithubHelp logo

clips / bratreader Goto Github PK

View Code? Open in Web Editor NEW
41.0 9.0 24.0 42 KB

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

Python 100.00%
brat python annotation nlp

bratreader's People

Contributors

andrewbrooks-o avatar benolayinka avatar erinspace avatar ronentk avatar stephantul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bratreader's Issues

problem_repomodel

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?

Bug in annotationimporter.py: char_index

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.

unicode in sentence __repr__

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.

it retrieves error when writing the xml file

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

problem_reading_documents

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.