-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
65 lines (49 loc) · 1.83 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from optparse import OptionParser
from containers import sentence
from lg_test import irc_logParser
from grammar_fsm import Semantics
from rule_engine import rule_engine
from rule_engine import test_rules
from debug import *
import linkGrammar
import analysis
import relex
import pprint
class main:
def option_parser(self):
self.parser = OptionParser()
self.parser.add_option("-r", action="store_true", dest="relex")
self.parser.add_option("--default", action="store_true", dest="default")
(self.options, self.args) = self.parser.parse_args()
def main(self):
semantics = Semantics()
logParser = irc_logParser()
log_data = logParser.loadLogs('logs/2009-08-1*', limit=200)
for sentences in log_data:
rule_eng = rule_engine()
if not sentences:
continue
if self.options.relex:
r = relex.relex()
sentence = r.process(sentences)
for x in sentence:
y = x.split('\n')
for z in y:
if z:
print z
if self.options.default:
from tagger import braubt_tagger
analogy = analysis.Analogies()
s = linkGrammar.sentence(sentences)
if s:
normal_words = sentences.split(' ')
container = sentence(s, normal_words)
container.atom = semantics.semanticsToAtoms(container)
test_rules(container)
for a in container.diagram:
debug(a)
analogy.similar(container)
if __name__ == '__main__':
m = main()
m.option_parser()
m.main()