cfgen
1.0.0
Markov 체인과 컨텍스트가없는 문법의 조합을 사용하여 두 언어 모델의 기능을 갖춘 임의의 문장을 생성합니다.
2014-2019 년 William Gilpin에 의해 만들어졌습니다
자동 설치
저장소를 다운로드하여 추출한 다음 실행하십시오
$ python setup.py install
종종 파서가 설치되지 않습니다. 대신 달리기
$ pip install git+git://github.com/emilmont/pyStatParser
수동 설치
요구 사항
선택적 설치 (모든 도구 사용)
이 명령을 실행하여 코드 및 기본 종속성을 수동으로 설치하십시오.
$ git clone https://github.com/williamgilpin/cfgen
$ conda install nltk
$ pip install git+git://github.com/emilmont/pyStatParser
문법을 스코어링하거나 결과 문장을 자동으로 수정하려면 Python 패키지 언어 확인을 설치하십시오.
$ pip install language-check
도구를 코퍼스에 가리키고 언어 모델을 설정하십시오. 여기서 우리는 Mary Shelley의 Frankenstein 2 그램을 사용합니다.
my_model = GrammarModel('cfgen/full_books/frankenstein.txt', 2)
이제 예제 문장을 생성하십시오
example_sentence = my_model.make_sentence()
corrected_example_sentence = clean_output_text(example_sentence, use_language_tool=True)
print(corrected_example_sentence)
전체 워크 플로는 파일 demos.ipynb 에 제공됩니다.
Mary Shelley의 Frankenstein에 대한 교육을받은 모델에서 :
these conversation possessed to his time
those sense all fulfillment, me of affairs a soul been of I.
The next kindness her black, light of it I wished as our perish certainty.
horrible wretch that memory, their lake I to me, which the glad unhappiness
of the paroxysm of a several engagement of Clerval in her apartment and all
mainland, and on a progress, me surprised so divine me.
요한 계시록에 대한 교육을받은 모델에서 :
Who said ever to no crown to was the listener and SECOND:
my man, and to the wheat,
and had eat in this angel.
Their pieces kill the sort the angel come up
to another translucent and weep any stone.
Her timeless will measure them to the day,
hold created with earth noises and hurled every nation.
There shown out upon the voice
It be in seventh which is to trample, I.
This tampering opened not for its time.
The land to their moment Who threw their glory to cherish that art.
The glory to the speaking, and at that white appearance, and say given
the thousand for the sake. And said show in myself. And it of no sweet victory
whose gateways enemies was loathe to the bowl
and it for them and worked out as my hast to every vision.
Their noise erase me.