MCPcopy Create free account
hub / github.com/baidu/lac / parse_tag

Method parse_tag

python/LAC/reader.py:192–203  ·  view source on GitHub ↗

convert segment data to lac data format

(self, line)

Source from the content-addressed store, hash-verified

190 Dataset.__init__(self, args, dev_count)
191
192 def parse_tag(self, line):
193 """convert segment data to lac data format"""
194 tags = []
195 words = line.strip().split()
196
197 for word in words:
198 if len(word) == 1:
199 tags.append('-S')
200 else:
201 tags += ['-B'] + ['-I'] * (len(word) - 2) + ['-E']
202
203 return "".join(words), tags
204
205if __name__ == "__main__":
206 parser = argparse.ArgumentParser(__doc__)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected