Split and Mating keywords

Source: Internet
Author: User
Split, match keyword
How do I split and match keywords within an article? For example, the following articles:

Do you really have no good results? My husband is five years younger than me, we just get married that will almost every day noisy, originally the emotional foundation did not play well, married soon had a child, the child is now three years old, in this three years do not know how many will, may be real life is such, the couple may have quarreled, and later after several quarrels, I also learned a lot, Two of people are mutual understanding, mutual tolerance, tolerance of each other. My husband is more childish, always angry, little things on the anger, we have been together in the last few years to play, also did not have the shadow, the husband spends money is not a plan, pay attention to famous brand, Eat also good, do not let buy angry or ignore you, oneself always rational not, we income general, He spends far more than our income, I am anxious in the heart also do not know how to do, because he does not listen to you say, he is quite arrogant oneself think others are inferior to him, say I am stupid, what also do not understand, really don't know how you grow up, so I also endure, who let me choose, still have for children I can endure is to hope that one day he will find himself and his mistakes, but recently I found that the more I surrender to him, the more insolent he went out to work, to find you something to do, said I went out to earn money to keep you, you can not idle, good you say what I do endure, see I did not wear socks said my feet chopped, I also endure, I do not want and he noisy boring, Come back to dinner in the evening, eat a meal to eat baked sweet potatoes, I said to you, need to buy, he said his brother-in-law said run the black car, I said you also go, on this sentence do not love to listen to, said I dropped sent jaunts, on the urgent said I do not want, will blind BB, anyway what nasty say what, say I do not work, how not I do not go to earn money, I said that now children can not take care of themselves, I tube good children is my task, you should go out to earn money, I said that when the children go to school I naturally earned, I said he should be tube, and wrong, say with what I should control you ah, and anxious to start to go crazy has been talking about what he thinks is particularly bad, And let you admit that he's right, I have no words to say, let him let him say, he again think you do not say, I said you adults do not count the villain I was wrong you will tolerate me for a while don't be angry he said no no no no no no no no no, I don't know what to do now. Put oneself wrong also change, found points own shortcomings, but not more rampant, I am not a woman of wisdom I now how to do, I hope you help, I really need you thank you!



I want to write down some of the words in the article as a keyword to use when the user publishes the article. Are there any algorithms/ideas that can achieve this requirement? Or can you only read and summarize/extract the keywords manually?
------Solution--------------------
1 A keyword table (can be added)
2. Calculate keyword Frequency

Don't do your own participle, hehe
Edit (the person/position referred to here) is still needed
------Solution--------------------
The 1 system Keyword table automatically matches the replacement keyword.
2 Specify keywords when user input

------Solution--------------------
Description
1, I use the encoding is GBK, if it is utf-8, please delete the relevant part of the code
2, the processing of the document when the landlord posted sample text
3, the code is now written, about the algorithm problem please correct me
Iconv_set_encoding ("internal_encoding", "utf-8");
Iconv_set_encoding ("output_encoding", "GBK");
Ob_start ("Ob_iconv_handler");

$FN = ' How to split and match keywords in an article _. txt ';

$p = new T;
$ar = $p->parse ($FN);
Print_r ($ar);
Print_r ($p->dat);

Class T {
var $maxlen = 4;//Maximum Group word length
var $dat = array ();
var $dict = array ();
function get ($offs =0) {
if ($this->i + $offs >= $this->len
------Solution--------------------
$offs >= $this->maxlen) return false;
$ch = $this->doc[$this->i + $offs];
if (In_array ($ch, $this->dict)) return false;
return $ch;
}
Function Parse ($filename) {
$this->dict = Explode ('
------Solution--------------------
', Iconv (' GBK ', ' utf-8 ', ',
------Solution--------------------

------Solution--------------------

------Solution--------------------

------Solution--------------------

------Solution--------------------

------Solution--------------------
? '));
$s = file_get_contents ($filename);
$s = iconv (' GBK ', ' utf-8 ', $s);
Preg_match_all ('/./u ', $s, $r);
$this->doc = $r [0];
$this->i = 0;
$this->len = count ($this->doc);
while ($this->i < $this->len) {
if ($ch = $this->get ())!== false) {
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.