-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhmmpy.py
More file actions
315 lines (287 loc) · 7.06 KB
/
Copy pathhmmpy.py
File metadata and controls
315 lines (287 loc) · 7.06 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
from ctypes import *
import platform
import json
class HMMDll():
Encoding = 'utf-8'
DllEncoding = 0
def __init__(self, dllpath):
if platform.system()=="Windows":
self.dll=WinDLL(dllpath)
else:
self.dll=CDLL(dllpath)
def call(self, funcname, arg=""):
func = getattr(self.dll, funcname)
func.restype = c_char_p
return func(arg.encode(self.Encoding), self.DllEncoding).decode(self.Encoding)
def encode(self, obj):
return json.dumps(obj,default = lambda x: x.__dict__)
class Environment:
def __init__(self):
self.Tags=[] #ValueTag
self.RoomConditions=[] #ValueCondition
self.Rooms =[] #Room
self.Paths =[] #path
self.Shortcuts =[] #RoomConditionExitModel
self.Whitelist = [] #string
self.Blacklist = [] #string
self.BlockedLinks =[] #Link
self.CommandCosts =[] #CommandCost
self.RoomTags =[] #RoomTag
class MapperOptions:
def __init__(self):
self.MaxExitCost = 0
self.MaxTotalCost = 0
self.DisableShortcuts = False
self.CommandWhitelist = [] #string
self.CommandNotContains = [] #string
class QueryPathAny:
def __init__(self):
self.From=[] #string
self.Target=[] #string
self.Environment=None
self.Options=None
class QueryPath:
def __init__(self):
self.Start=""
self.Target=[] #string
self.Environment=None
self.Options=None
class KeyTypeValue:
def __init__(self):
self.Key=""
self.Type=""
self.Value=""
class SnapshotKeyList:
def __init__(self):
self.Keys=[] #KeyTypeValue
class KeyType:
def __init__(self):
self.Key=""
self.Type=""
class LandmarkKeyList:
def __init__(self):
self.LandmarkKeys=[] #KeyType
class KeyList:
def __init__(self):
self.Keys=[] #string
class ListOption:
def __init__(self):
self.Keys=[] #string
self.Groups=[] #string
class ValueTag:
def __init__(self):
self.Key=""
self.Value=0
class Data:
def __init__(self):
self.Key=""
self.Value=""
class ValueCondition:
def __init__(self):
self.Key=""
self.Not=False
self.Value=0
class Exit:
def __init__(self):
self.Command=""
self.To=""
self.Cost=1
self.Conditions=[] #ValueCondition
class Room:
def __init__(self):
self.Key=""
self.Name=""
self.Desc=""
self.Group=""
self.Tags=[] #ValueTag
self.Exits=[] #Exit
self.Data=[] #Data
class Rooms:
def __init__(self):
self.Rooms=[] #Room
class Marker:
def __init__(self):
self.Key=""
self.Value=""
self.Group=""
self.Desc=""
self.Message=""
class Markers:
def __init__(self):
self.Markers=[] #Marker
class Route:
def __init__(self):
self.Key=""
self.Desc=""
self.Group=""
self.Message=""
self.Rooms=[] #string
class Routes:
def __init__(self):
self.Routes=[] #Route
class Trace:
def __init__(self):
self.Key=""
self.Group=""
self.Desc=""
self.Message=""
self.Locations=[] #string
class Traces:
def __init__(self):
self.Traces=[] #Trace
class RegionItem:
def __init__(self):
self.Not = False
self.Type = ""
self.Value = ""
class Region:
def __init__(self):
self.Key=""
self.Group=""
self.Desc=""
self.Message=""
self.Items=[] #RegionItem
class Regions:
def __init__(self):
self.Regions=[] #Region
class Shortcut:
def __init__(self):
self.Key=""
self.Command=""
self.To=""
self.RoomConditions=[] #ValueCondition
self.Conditions=[] #ValueCondition
self.Cost=1
self.Group=""
self.Desc=""
class Shortcuts:
def __init__(self):
self.Shortcuts=[] #Shortcut
class Variable:
def __init__(self):
self.Key=""
self.Value=""
self.Group=""
self.Desc=""
class Variables:
def __init__(self):
self.Variables=[] #Variable
class Landmark:
def __init__(self):
self.Key=""
self.Type=""
self.Value=""
self.Group=""
self.Desc=""
class Landmarks:
def __init__(self):
self.Landmarks=[] #Landmark
class Snapshot:
def __init__(self):
self.Key=""
self.Timestamp=0
self.Group=""
self.Type=""
self.Count=1
self.Value=""
class Snapshots:
def __init__(self):
self.Snapshots=[] #Snapshot
class Path:
def __init__(self):
self.From=""
self.Command=""
self.To=""
self.Conditions=[] #ValueCondition
self.Cost=1
class RoomConditionExit:
def __init__(self):
self.RoomConditions=[] #ValueCondition
self.Command=""
self.To=""
self.Conditions=[] #ValueCondition
self.Cost=1
class Link:
def __init__(self):
self.From=""
self.To=""
class CommandCost:
def __init__(self):
self.Command=""
self.To=""
self.Cost=1
class RoomTag:
def __init__(self):
self.Room=""
self.Key=""
self.Value=1
class Dilate:
def __init__(self):
self.Source=[] #string
self.Iterations=1
self.Environment=None
self.Options=None
class TrackExit:
def __init__(self):
self.Start=""
self.Command=""
self.Environment=None
self.Options=None
class Key:
def __init__(self):
self.Key=""
class GetRoom:
def __init__(self):
self.Key=""
self.Environment=None
self.Options=None
class SnapshotFilter:
def __init__(self):
self.Key = None
self.Type = None
self.Group = None
self.MaxCount = 0
class TakeSnapshot:
def __init__(self):
self.Key = ""
self.Type = ""
self.Group = ""
self.Value = ""
class SnapshotSearch:
def __init__(self):
self.Type = None
self.Group = None
self.Keywords = [] #string
self.PartialMatch = True
self.Any = False
self.MaxNoise = 0
class RoomFilter:
def __init__(self):
self.RoomConditions = [] #ValueCondition
self.HasAnyExitTo = [] #string
self.HasAnyData = [] #Data
self.HasAnyName = [] #string
self.HasAnyGroup = [] #string
self.ContainsAnyData = [] #Data
self.ContainsAnyName = [] #string
self.ContainsAnyKey = [] #string
class SearchRooms:
def __init__(self):
self.Filter = RoomFilter()
class FilterRooms:
def __init__(self):
self.Filter = RoomFilter()
self.Source = [] #string
class GroupRoom:
def __init__(self):
self.Room=""
self.Group=""
class TagRoom:
def __init__(self):
self.Room=""
self.Tag=""
self.Value=0
class TraceLocation:
def __init__(self):
self.Key = ""
self.Location = ""