开发者

Searching a certaing string depending on the keywods in string and finding out labels where the keyword belongs

开发者 https://www.devze.com 2023-03-20 03:14 出处:网络
I want to develop a mechanism for search, but I have some requirements for it. I am not getting where should I start.

I want to develop a mechanism for search, but I have some requirements for it.

I am not getting where should I start.

For example

I have to search this string

stringToSearch = 'I have to search something';

For that I am going to add some labels to certain keywords at start.

suppose Messi will come under football,

and Rain will come under Weather

and Search will come in Search Engine, Google,...

Like that so I have Labels for keywords in short and it could be possible that one keyword is in multiple labels.

Now when I am searching some string I do have to calculate best labels for it and I want to do it on the basis of criteria mentioned below.

  1. I will add keywords to labels on the basis of user answering a search string belongs to which label (User u can take here as a answering agents who will chose their labels so that question of particular labels come to them)

  2. Every time 开发者_如何学Pythonkeywords match will be counted.

  3. If more than one keywords in a string belongs to one labels then select that labels as relevant one.

I have just an idea.

I am good with PHP,Jquery. Some one suggested me to not code it in PHP.

Please suggest me the technology

Thank you


a) You split the string at spaces into an array (explode, preg_split, ...)

b) You use array_walk or array_map to have a callback check if the entry corresponds to a label and then replace the value with the label or add the label as an entry to the returned array. If a word doesnt have label you delete it or leave it out.

c) Then you have array_count_values count the labels

0

精彩评论

暂无评论...
验证码 换一张
取 消