run_task.sh 실행시 오류가 발생합니다. morfessor와 관련된 도움말 또는 참고 사이트를 얻을 수 있을까요?

732 views
Skip to first unread message

이준기

unread,
May 30, 2018, 2:24:22 AM5/30/18
to zeroth-help
morfessor -l zeroth_morfessor.seg -S morfessor.model.txt -x morfessor.lexicon
위 명령어 실행시 실제 존재하는 파일이 zeroth_morfessor.seg 뿐인 것이 맞는지요?

morfessor를 사용할때 참고 할 만한 추천 사이트같은것이 있나요?

run_task.sh 명령어 실행시 아래와 같은 오류가 발생합니다.


No training data files specified.
Saving segmentations to 'morfessor.model.txt'...
Fatal Error <type 'exceptions.AttributeError'> 'BaselineModel' object has no attribute '_segment_only'
Traceback (most recent call last):
  File "/bin/morfessor", line 4, in <module>
    __import__('pkg_resources').run_script('Morfessor==2.0.4', 'morfessor')
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1462, in run_script
    exec_(script_code, namespace, namespace)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 41, in exec_
    exec("""exec code in globs, locs""")
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/Morfessor-2.0.4-py2.7.egg/EGG-INFO/scripts/morfessor", line 22, in <module>
    
  File "/usr/lib/python2.7/site-packages/Morfessor-2.0.4-py2.7.egg/EGG-INFO/scripts/morfessor", line 13, in main
    
  File "build/bdist.linux-x86_64/egg/morfessor/cmd.py", line 491, in main
    
  File "build/bdist.linux-x86_64/egg/morfessor/io.py", line 83, in write_segmentation_file
    for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom,
  File "build/bdist.linux-x86_64/egg/morfessor/baseline.py", line 473, in get_segmentations
  File "build/bdist.linux-x86_64/egg/morfessor/baseline.py", line 104, in _check_segment_only
AttributeError: 'BaselineModel' object has no attribute '_segment_only'

Lucas Jo

unread,
May 30, 2018, 5:42:33 AM5/30/18
to zeroth-help
아 이 문제는 morfessor 가 최근에 업데이트 되면서 생기는 문제더군요.

공개된 zeroth_morfessor.seg 파일에서 morfessor.model.txt, morfessor.lexicon 두 가지 파일을 다시 만들 필요 없도록

코드를 수정하도록 준비중입니다. 




이준기

unread,
May 30, 2018, 7:15:58 AM5/30/18
to zeroth-help
감사합니다.

KyungGi Moon

unread,
May 30, 2018, 8:10:25 AM5/30/18
to zeroth-help
1. morfessor에 대한 설명은 아래 논문 괜찮은 것 같습니다. 

https://www.sri.com/sites/default/files/publications/morph-based_speech_recognition_and_modeling_of.pdf


2. -S에 의해 save되는 model정보를 사용하는 것이 아니라 -x에 의해 생성되는 morph lexicon을 가지고 morpheme을 만드는 것으로 알고 있습니다.
    -x옵션은 Morfessor 2.0 documentation(url: http://morfessor.readthedocs.io/en/latest/cmdtools.html?highlight=morfessor)
에서 나온 내용을 기준으로 공식적으로 기술된 옵션은 아닌 것 같은데,  zeroth프로젝트에서 morfessor를 사용할 때 왜 -x옵션을 통해 생성한 morph lexicon을 가지고 왜 morpheme을 만드나요?
   
  *  morfessor -l zeroth_morfessor.seg -S morfessor.model.txt -x morfessor.lexicon

Lucas Jo

unread,
May 30, 2018, 9:16:22 AM5/30/18
to zeroth-help
zeroth 프로젝트에서 최종적인 발음사전 lexicon 을 만드는 부분과 LM 을 만드는 부분이 조금 달라서 그렇습니다. 

lexicon 을 만들때는 발음의 다양성을 찾기위해 -S 옵션으로 만들어진 모델을 사용합니다.
LM을 만들때는 단순히 uniq. morpheme 만 알면 되기 때문에 -x 옵션으로 만들어진 리스트를 사용합니다.

srsumm...@gmail.com

unread,
May 19, 2019, 8:55:36 PM5/19/19
to zeroth-help
안녕하세요.

아직 run_task.sh에
morfessor -l zeroth_morfessor.seg -S morfessor.model.txt -x morfessor.lexicon
을 수행할 때

Loading model from 'zeroth_morfessor.seg'...
Done.

No training data files specified.
Saving segmentations to 'morfessor.model.txt'...
Fatal Error <type 'exceptions.AttributeError'> 'BaselineModel' object has no attribute '_segment_only'
Traceback (most recent call last):
  File "/home/sig/kaldi/tools/morfessor/scripts/morfessor", line 22, in <module>
    main(sys.argv[1:])
  File "/home/sig/kaldi/tools/morfessor/scripts/morfessor", line 13, in main
    morfessor.main(args)
  File "/home/sig/kaldi/tools/morfessor/morfessor/cmd.py", line 491, in main
    io.write_segmentation_file(args.savesegfile, model.get_segmentations())
  File "/home/sig/kaldi/tools/morfessor/morfessor/io.py", line 83, in write_segmentation_file
    for count, _, segmentation in segmentations:
  File "/home/sig/kaldi/tools/morfessor/morfessor/baseline.py", line 473, in get_segmentations
    self._check_segment_only()
  File "/home/sig/kaldi/tools/morfessor/morfessor/baseline.py", line 104, in _check_segment_only
    if self._segment_only:

AttributeError: 'BaselineModel' object has no attribute '_segment_only'

에러가 발생하고 있습니다.

혹시 어떻게 수정하면 최신 morfessor에서 해당 이슈 없이 진행될 수 있을지 가이드 가능하실까요?

Lucas Jo

unread,
May 21, 2019, 6:17:13 PM5/21/19
to zeroth-help
morfessor -l zeroth_morfessor.seg -S morfessor.model.txt -x morfessor.lexicon

명령어는 바이너리 zeroth_morfessor.seg 파일을 텍스트 파일 두개로 변환하는 것입니다.

텍스트 파일 모델이 특별히 사용할 필요가 없다면 실행하지 않아도 됩니다.
Reply all
Reply to author
Forward
0 new messages