Commit 28f11d57f5b5e556775161ce7e97aee32db66069

Authored by Michał Lenart
1 parent 85860116

- praca nad parserem dla reguł zlepiania

git-svn-id: svn://svn.nlp.ipipan.waw.pl/morfeusz/morfeusz@84 ff4e3ee1-f430-4e82-ade0-24591c43f1fd
fsabuilder/morfeuszbuilder/segrules/segrules.py 0 → 100644
  1 +'''
  2 +Created on 24 sty 2014
  3 +
  4 +@author: mlenart
  5 +'''
  6 +
  7 +class SegmentRule(object):
  8 + '''
  9 + classdocs
  10 + '''
  11 +
  12 +
  13 + def __init__(self):
  14 + '''
  15 + Constructor
  16 + '''
  17 +
  18 +class SimpleRule(SegmentRule):
  19 +
  20 + def __init__(self, name, typeId):
  21 + self.name = name
  22 + self.identifier = typeId
  23 +
  24 +class ComplexRule(SegmentRule):
  25 +
  26 + def __init__(self, children):
  27 + self.children = children
  28 +
  29 +class ConcatRule(ComplexRule):
  30 +
  31 + def __init__(self, children):
  32 + super(ConcatRule, self).__init__(children)
  33 +
  34 +class OrRule(ComplexRule):
  35 +
  36 + def __init__(self, children):
  37 + super(OrRule, self).__init__(children)
  38 +
  39 +class UnaryRule(SegmentRule):
  40 +
  41 + def __init__(self, child):
  42 + self.child = child
  43 +
  44 +class ZeroOrMoreRule(UnaryRule):
  45 +
  46 + def __init__(self, child):
  47 + super(ZeroOrMoreRule, self).__init__(child)
  48 +
  49 +class IgnoreOrthRule(UnaryRule):
  50 +
  51 + def __init__(self, child):
  52 + super(IgnoreOrthRule, self).__init__(child)
... ...
fsabuilder/morfeuszbuilder/segrules/segsfsa.py 0 → 100644
  1 +'''
  2 +Created on 24 sty 2014
  3 +
  4 +@author: mlenart
  5 +'''
  6 +
  7 +class SegmentsFSAState(object):
  8 +
  9 + def __init__(self):
  10 + self.transitionsMap = {}
  11 +
  12 + def addSegmentRule(self, segmentRule):
  13 + pass
  14 +
  15 +class SegmentsFSA(object):
  16 +
  17 + def __init__(self):
  18 + self.initialState = SegmentsFSAState()
  19 +
  20 + def addSegmentRule(self, segmentRule):
  21 + self.initialState.addSegmentRule(segmentRule)
  22 +
  23 + def serialize(self):
  24 + res = bytearray()
  25 + return res
... ...