Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jtauber/qmorph
base: 3dc3986377
...
head fork: jtauber/qmorph
compare: 65e5c47d4c
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 33 additions and 3 deletions.
  1. +4 −3 examples/morphgnt/domain.py
  2. +29 −0 qmorph.py
View
7 examples/morphgnt/domain.py
@@ -1,9 +1,10 @@
+import unicodedata
+
from qmorph import *
-# @@@ no-op for now
-def strip_accents(x):
- return x
+def strip_accents(s):
+ return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn'))
## PROPERTIES
View
29 qmorph.py
@@ -89,6 +89,35 @@ def _(t):
## query classes
+class Display:
+
+ def __init__(self, display, given=TRUE, limit=None):
+ self.display = display
+ self.given = given
+ self.limit = limit
+ self.__doc__ = display.__doc__
+ if given is not TRUE:
+ self.__doc__ += " " + given.__doc__
+ if limit is not None:
+ self.__doc__ += " limit {0}".format(limit)
+ self.results = []
+
+ def process(self, t):
+ if self.given(t):
+ self.results.append(t)
+
+ def result(self):
+ print()
+ print("=========================================")
+ print(self.__doc__)
+ print("=========================================")
+ for t in self.results[:self.limit]:
+ print(self.display(t))
+ print("=========================================")
+ print("{0} items".format(len(self.results)))
+ print("=========================================")
+
+
class PartCount:
def __init__(self, prop, given=TRUE):

No commit comments for this range

Something went wrong with that request. Please try again.