Skip to content

Commit

Permalink
Dealing with string issues (issue #79).
Browse files Browse the repository at this point in the history
  • Loading branch information
marcverhagen committed Dec 15, 2020
1 parent 465f9df commit c378f68
Show file tree
Hide file tree
Showing 40 changed files with 237 additions and 53 deletions.
1 change: 1 addition & 0 deletions components/classifier/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from library.main import LIBRARY
from utilities import logger, mallet
from components.classifier import vectors
from io import open

TTK_ROOT = os.environ['TTK_ROOT']

Expand Down
1 change: 1 addition & 0 deletions components/common_modules/chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from components.evita.settings import EVITA_NOM_WNPRIMSENSE_ONLY

from utilities import logger
from io import open


# Get the Bayesian event recognizer
Expand Down
1 change: 1 addition & 0 deletions components/evita/wordnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from library import forms
import utilities.binsearch as binsearch
import utilities.logger as logger
from io import open


# Open dbm's with information about nominal events. If that does not work, open
Expand Down
1 change: 1 addition & 0 deletions components/evita/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from library.tarsqi_constants import EVITA
from library.main import LIBRARY
from components.evita.main import Evita
from io import open


# Set this to True if you want to do a simplistic evaluation of how many of the
Expand Down
1 change: 1 addition & 0 deletions components/merging/sputlink/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .mappings import abbreviate_convex_relation
from utilities import logger
from library.main import LIBRARY
from io import open

DEBUG = True
DEBUG = False
Expand Down
1 change: 1 addition & 0 deletions components/merging/sputlink/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .utils import CompositionTable
from .utils import html_graph_prefix
from library.main import LIBRARY
from io import open

DEBUG = False
DEBUG = True
Expand Down
1 change: 1 addition & 0 deletions components/merging/sputlink/rules/generateRules.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Node, EventNode, TimexNode, Point, Link, PLink

from closure import Axiom, Closure
from io import open

settings = {}
settings['debug'] = 0
Expand Down
2 changes: 2 additions & 0 deletions components/merging/sputlink/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@


from __future__ import absolute_import
from io import open
def intersect_relations(rels1, rels2):
"""Returns the intersection of two relation sets. Returns None if both
of the two sets are None."""
Expand Down
1 change: 1 addition & 0 deletions components/simpletime/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import
import os, sys
from io import open


def elements_file():
Expand Down
1 change: 1 addition & 0 deletions deprecated/demo/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import os
from docmodel.xml_parser import Parser, create_dct_element
from library.tarsqi_constants import BLINKER, SLINKET, S2T, CLASSIFIER
from io import open

TTK_ROOT = os.environ['TTK_ROOT']

Expand Down
1 change: 1 addition & 0 deletions deprecated/get_lexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import sys, os

from xml.dom.minidom import parse
from io import open


def getText(nodelist):
Expand Down
1 change: 1 addition & 0 deletions deprecated/get_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import os, glob

from xml.dom import minidom
from io import open


INDIR = "data/out/Timebank"
Expand Down
1 change: 1 addition & 0 deletions deprecated/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from docmodel.xml_parser import Parser
from library.tarsqi_constants import PREPROCESSOR, GUTIME, EVITA, SLINKET, S2T
from library.tarsqi_constants import CLASSIFIER, BLINKER, CLASSIFIER, LINK_MERGER
from io import open

TTK_ROOT = os.environ['TTK_ROOT']

Expand Down
1 change: 1 addition & 0 deletions deprecated/sputlink/rule_creation/generateRules.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
Node, EventNode, TimexNode, Point, Link, PLink

from closure import Axiom, Closure
from io import open

settings = {}
settings['debug'] = 0
Expand Down
1 change: 1 addition & 0 deletions deprecated/xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from types import UnicodeType, IntType, StringType, NoneType
import xml.parsers.expat
from xml.sax.saxutils import escape, quoteattr
from io import open


# variable used for assigning unique IDs to XmlDocElements
Expand Down
1 change: 1 addition & 0 deletions docmodel/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from library.main import LIBRARY
from utilities import logger
from io import open


TIMEX = LIBRARY.timeml.TIMEX
Expand Down
1 change: 1 addition & 0 deletions docmodel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from docmodel.docstructure_parser import DocumentStructureParser

from utilities import logger
from io import open


PARSERS = {'ttk': (SourceParserTTK, MetadataParserTTK),
Expand Down
7 changes: 6 additions & 1 deletion docmodel/source_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

from docmodel.document import SourceDoc, ProcessingStep
from utilities.lif import Container, LIF
from io import open


class SourceParser(object):
Expand Down Expand Up @@ -214,7 +215,11 @@ def parse_file(self, filename, tarsqidoc):
text and tags in SourceDoc."""
self.sourcedoc = SourceDoc(filename)
# TODO: should this be codecs.open() for non-ascii?
self.parser.ParseFile(open(filename))
# self.parser.ParseFile(open(filename))
# NOTE: actually, the above line needed to replaced with the following
# while preparing to port code to Python3.
content = open(filename).read()
self.parser.Parse(content)
self.sourcedoc.finish()
tarsqidoc.sourcedoc = self.sourcedoc

Expand Down
Loading

0 comments on commit c378f68

Please sign in to comment.