0

2 セットの .txt ファイルを含む注釈付きコーパスを使用しています。最初のセットには注釈が付けられたドキュメント (つまり、記事、ブログ投稿など) が含まれ、2 番目のセットには実際の注釈が含まれます。注釈を注釈付きのテキストに一致させる方法は、「バイト スパン」を使用することです。readme ファイルから:

"The span is the starting and ending byte of the annotation in 
the document.  For example, the annotation listed above is from 
the document, temp_fbis/20.20.10-3414.  The span of this annotation 
is 730,740.  This means that the start of this annotation is 
byte 730 in the file docs/temp_fbis/20.20.10-3414, and byte 740 
is the character after the last character of the annotation."

質問: ドキュメントの開始バイトと終了バイトにインデックスを付けて、元のドキュメントのテキストに注釈を一致させるにはどうすればよいですか? 何か案は?私はこれにPythonで取り組んでいます...

4

2 に答える 2

0
"This means that the start of this annotation is 
byte 730 in the file docs/temp_fbis/20.20.10-3414, and byte 740 
is the character after the last character of the annotation.

     blah, blah, blah, example annotation, blah, blah, blah
                       |                 |
                  start byte          end byte

The data_type of all annotations should be 'string'."
于 2011-10-28T20:27:37.887 に答える
0
#open, seek, read
start, end = 730,740
f = open("myfile", "rb")
try:
    f.seek(start)
    while start > end
        byte = f.read(1)
        # Do stuff with byte.
        start -= 1
finally:
    f.close()
于 2011-10-28T20:34:01.310 に答える