Python NLTK Library contains a large number of corpus, but most of them are in English, but there is a sinica (Central Research Institute) provided by the traditional Chinese corpus, deserves our attention.
Before using this corpus, let's first check to see if the corpus has been installed.
>>>import Nltk>>>nltk.download ()
Check whether the Sinica_treebank indicated by the arrows is installed, and if not, install first.
After installation, you can use the
Import nltkfrom Nltk.corpus Import Sinica_treebankprint (Sinica_treebank.words ())
Results: [' one ', ' Friendship ', ' ka Jen ', ' and ', ' I ', ' live ', ' the same ', ' Alley ', ' we ', ...]
(1) Look at the NLTK Chinese grammar tree.
>>>sinica_treebank.parsed_sents () [33].draw ()
Long live Python!!!
(2) Search Chinese text
Import nltkfrom Nltk.corpus import sinica_treebanksinica_text=nltk. Text (Sinica_treebank.words ()) Print (Sinica_text.concordance (' I '))
Results:
I live in the same alley. We are neighbors and classmates. We often go together
He is also a classmate of the same class. We often go to school together, and one day, when I went to her house, I waited for the door to be pressed, and there was no silence.
When I came to her house in the sky, I waited for the door to be pressed, and there was no movement. When I wanted to leave, the sudden rush of footsteps Ga Jian opened the door.
Suddenly the rapid footsteps of the Ga Jian opened the door loudly called fast my mother dizzy down Ga Jian grabbed my hand and hurried into the room to see
Ga Jian opened the door and shouted quickly. My mother dizzy down Ga Jian grabbed my hand and rushed into the room to see her mother lying on the floor.
Her mother was lying on the ground, face-Hitomi white as a piece of paper, and this kind of situation scares me. Ga Jian The sound of crying, some trembling shaking my brain.
This kind of situation scares me. Ga Jian cry a little trembling shake my mind the space is not hyo how to do it, I have a chance
When my mind was in a blank space, I didn't hyo how to do it. I just asked her about your father. He was on a business trip. Ga Jian wiped his tears I took her
I asked her about your dad for a while. Ga Jian tears I hold her hands she's got ice and cold this time there's a thought suddenly blink
Hold her hands, her hands are cold and icy. There was a thought that suddenly flashed through my eyes I helped her flick 119 please save the car and pat her on the back.
Hands, her hands are icy and cold. There was a thought that suddenly flashed through my eyes I helped her flick 119 please save the car and pat her on the back to comfort her.
Flick 119 Please save the car and pat her on the back to comfort her. I'll be with you soon. The ambulance stopped at her house, the paramedic was quick.
The paramedic quickly put her mother on the rescue car, and she said thank you for your help. I hold her hand and say thank you because we
Her mother lifted the car to the car, and she said thank you for your help. I'm holding her hand and saying thank you. Because we are good friends, two private.
Before the car said thank you for your help I'm holding her hand and saying thank me because we are good friends two private love like red sun scattered light
To find him out of a time when the lack of a trip and to tell him I see you boring boring is not happy is not the trip to Beijing is not enough to have some silver
The heretics and the silver to the member. Holding his hand and saying you don't have to give it back to me, I'm just trying to do my part, and then I have the opportunity to hope that you can help.
The Silver member heretics thank the time member to hold his hand and say you don't have to give it back to me. I have a chance to hope you can help others.
Take a test of the book students with trembling shaking hands to the silver with tears said thank you I do not know how to report you River patrol calmed said you don't have to thank me also do not need
Thank you I do not know how to report you River patrol calmed said you do not have to thank me and I do not have to return to my four-happy reading class in the language of the teacher called me
Know how to report you River patrol calmed said you do not have to thank me and I do not have to report back to my four-happy reading class when the teacher called us this group to read books
While reading the language class, the teacher asked us to read this group and report that I was the first to stand up and say that the good book we read is the little Prince. This is the French.
The little Prince told him that the two men who traveled on the planet became intimate friends. After I said it, the group stood up and said that the little prince was a loving man.
On the star every day to take care of the roses, to clean up the volcanic ash and to appreciate the sunset I like this free life Pearl said the most brilliant part of this book encountered
Businessmen and other young princes do not like arrogant people do not like the hypocrites of the people I think the little prince is upright and Appin said that there are many things in this book worth thinking about.
Natural language Processing--NLTK Chinese corpus corpus