The content of the invention
It is overcome the deficiencies in the prior art the mesh of the present invention, proposes that one kind is easy to model and can improve recommendation efficiency
Method is recommended based on the real-time place to go of context and user interest with the open network of accuracy.
The present invention solves its technical problem and takes following technical scheme to realize:
Method, including place to go is recommended to recommend client based on the real-time place to go of context and user interest in a kind of open network
Processing step, place to go recommendation server processed offline step and the online processing step of place to go recommendation server are held, wherein:
The place to go recommends the client process step to be:The configuration file and context of definition user are simultaneously sent to server
Port;
The place to go recommendation server processed offline step is:Gather place to go related data, carry out data normalization and to
Quantify:
The online processing step of place to go recommendation server is:Intercept user request, parsing user profile and up and down
Literary information, Similarity Measure is carried out based on linear interpolation, sequence similarity obtains recommendation results.
The configuration file includes scoring and the label in place to go visiting situation and each place to go, and context includes place to go
Season, geographical position, travelling number and travelling purpose.
The place to go recommendation server processed offline step comprises the following steps:
Step 1:Multiple websites are specified to carry out place to go data grabber;
Step 2:By place to go alignment of data, the same place trade company of different comment websites is subjected to disambiguation;
Step 3:Vectorization is carried out to the data in each place to go, is stored in database;
Step 4:Keyword dictionary corresponding to context is defined, is stored in database.
The step 1 is for comment website crawl name of firm, trade company's brief introduction, score information, front evaluation text and bears
Text is evaluated in face, and name of firm, trade company's brief introduction, merchant location, front evaluation text and unfavorable ratings are captured for merchant website
Text.
The each place to go data of the step 3 carry out vectorization each trade company include following eight groups of vector representations it in semanteme
The feature of aspect:The TFIDF semantic vectors of name of firm, the LSI semantic vectors of name of firm, the TFIDF of trade company's brief introduction are semantic
Vector, the LSI semantic vectors of trade company's brief introduction, the TFIDF semantic vectors of front evaluation text, the LSI of front evaluation text are semantic
The LSI semantic vectors of vector, the TFIDF semantic vectors of unfavorable ratings text and unfavorable ratings text.
The online processing step of place to go recommendation server comprises the following steps:
Step 1:Request of the place to go recommendation server to user carry out interception go forward side by side row information parsing;
Step 2:Place to go recommendation server carries out vectorization processing to the configuration file of user, by user interest configuration file
Information MAP with place to go in database is in same description coordinate system;
Step 3:Place to go recommendation server carries out vectorization processing to context, and the front evaluation in context and place to go is reflected
Penetrate in same description coordinate system;
Step 4:The vector of context of the place to go recommendation server in the user interest preference and step 3 in step 2,
Calculated with the vector in all places to go in database, it is right with " user, context " that place to go is calculated by linear interpolation method
Similarity;
Step 5:The similarity that step 4 obtains is ranked up, recommends forward place to go of sorting, returning result.
The step 4 calculates similarity s using equation below:
Wherein, p is place to go, and u is user, and c is content, simfunc() is the two corresponding vectorial cosine similarity;
Operation in set is to calculate the similarity relation in user interest preference and place to go, including:The TFIDF semantic vectors of name of firm,
The LSI semantic vectors of name of firm, the TFIDF semantic vectors of trade company's brief introduction, the LSI semantic vectors of trade company's brief introduction, front evaluation
The TFIDF semantic vectors of text, the LSI semantic vectors of front evaluation text, the TFIDF semantic vectors of unfavorable ratings text and negative
Evaluate the LSI semantic vectors of text in face };simcontext_lsi(p, c) is used to calculate place to go and the potential applications of context vector reflect
Lsi similarity relation is penetrated, is calculated using the corresponding vector of place to go front evaluation;simcontext_tfidf(p, c) is used to calculate
Place to go and the vocabulary tfidf similarity relations of context vector, calculated using the corresponding vector of place to go front evaluation;W is every
One corresponding coefficient.
The advantages and positive effects of the present invention are:
1st, the present invention obtains the web data in place to go by open network, and carries out disambiguation pretreatment;With reference to user configuration
File and context, the personalized ordering in place to go is provided, in the case of limited training data, effectively can be entered using context
The row degree of correlation judges that algorithm can be responded within the extremely short time, and time complexity is low, with higher accuracy and stably
Property, it can be widely applied in the personalized place to go real-time recommendation based on context.
2nd, the season residing for user, geographical position, travelling number, travelling purpose are regarded as context by the present invention, are passed through
The place to go of context and user interest is recommended, and while can helping to obtain commercial interest, is also brought advantage to the user.
3rd, the present invention is reasonable in design, is easy to model, and the historical behavior preference of abundant user is consistent with current Behavior preference special
Context (such as geographical position, trip type, season situations such as relevant) of the Behavior preference residing for it of point and user instantly,
The advantage of mankind's priori can be utilized, significantly improves and recommends efficiency and performance, raising is based on context place to go real-time recommendation
Accuracy rate.
Embodiment
The embodiment of the present invention is further described below in conjunction with accompanying drawing.
It is of the invention mainly to be realized using statistical machine learning is theoretical with crawler technology, in order to ensure the normal operation of system,
In the present embodiment, used computer platform is equipped with the internal memory not less than 8G, CPU core calculation not less than 4 and dominant frequency not
Low 2.6GHz, video memory are not less than 1GB, Linux 14.04 and above version 64 bit manipulation systems, and install python2.7 with
The Kinds of Essential Software environment such as upper version.
Method is recommended to recommend including place to go based on the real-time place to go of context and user interest in the open network of the present invention
Client process step, place to go recommendation server processed offline step and the online processing step of place to go recommendation server, below
Illustrate respectively:
1st, client process step is recommended in place to go:The configuration file and context of definition user are simultaneously sent to server end
Mouthful.Wherein, configuration file includes scoring and the label in place to go visiting situation and each place to go, and context includes residing season
Section, geographical position, travelling number, travelling purpose.
2nd, place to go recommendation server processed offline step is:Place to go related data is gathered, carries out data normalization and vector
Change, specifically include following steps:
Step 1:Multiple websites are specified to carry out place to go data grabber.
Because user has building-up effect, it can flock together and carry out place to go comment and cross-referenced.Therefore the present invention chooses two class pages
Description file of the face as each place to go.The first kind page is to comment on trade company's page on website, such as on popular comment website
Trade company page http://www.dianping.com/shop/18570510;The another kind of page is the homepage of trade company, such as wheat
As the homepage https of labor://www.mcdonalds.com.cn/.
For preceding a kind of page, some comment websites, such as Yelp, Foursquare and TripAdvisor provide friend
Good exploitation API can directly access content, scoring and the comment of retail shop.Handled by the page, obtain name of firm, trade company's letter
It is situated between, score information, front evaluation text, unfavorable ratings text.
For the second class page, retrieved using the topic of homepage on Yelp, using first returning result as business
The supplement of householder's page.Name of firm, trade company's brief introduction, merchant location are obtained on homepage, is scored and obtained according to the trade company on Yelp
Score information, front evaluation text, unfavorable ratings text.Wherein, evaluation text in front is that user gives a mark fraction higher than average
Comment text, unfavorable ratings text are the comment text that user's marking fraction is less than average, and the comment text equal to average is not examined
Consider.
Data after crawl are stored, and data storage is json forms.
Step 2:By the place to go alignment of data of crawl, the same place trade company that different will comment on websites carries out disambiguation.
Data disambiguation is mainly based upon the geographical location information and name of firm shown on the page.Geographical position is based on and business
Name in an account book claims to be based on string matching progress, if just the same, then it is assumed that be same place trade company.
Step 3:Vectorization is carried out to each place to go data, is stored in database.
Text-string is converted into vector by vectorization, and this step is operated towards name of firm, trade company's brief introduction, and front is commented
Valency text, unfavorable ratings text.Name of firm does not process, and is only segmented.For other 4 except name of firm successively
Carry out following pretreatment operation:Participle, stop words is removed, remove the word that the middle word frequency of this is less than 20, remove the 30 of word frequency maximum
Individual word, removes punctuation mark.
Then according to word frequency by text-string vectorization, i.e., each character string is a vector on dictionary, vector
It is exactly the frequency that word occurs in current string in dictionary corresponding to dimension per dimension.Assuming that dictionary have word " you, I, he,
, on, under ", be after the pretreatment of current text character string " I, I, on ", then be after current text character string vector (0,
2,0,1,1,0)。
After vectorization, the semantic vector of text-string is modeled.Be used herein as TFIDF (Term Frequency-
Inverse Document Frequency) weighing computation method and LSA (Latent Semantic Analysis) potential language
Adopted analysis method, the text vector of acquisition is mapped in semantic space.
Finally, there is its feature in terms of semanteme of eight groups of vector representations in each trade company, is the TFIDF of name of firm respectively
The LSI semantic vectors of semantic vector, name of firm, the TFIDF semantic vectors of trade company's brief introduction, the LSI semantic vectors of trade company's brief introduction,
The TFIDF semantic vectors of front evaluation text, the LSI semantic vectors of front evaluation text, the TFIDF of unfavorable ratings text are semantic
Vector, the LSI semantic vectors of unfavorable ratings text.
Step 4:Keyword dictionary corresponding to context is defined, is stored in database.
The present invention by contextual definition be active user trip some specific dimensions situation, including season (spring, the summer,
Autumn, winter), the purpose (such as commercial affairs trip, tourism trip, trip of being on home leave) of travelling, entourage (one, family, group), other
Item of enumerating fall within context.According to different contexts, the related keyword of hand picking, such as selected on " summer "
" heat ", " cold drink ", " barbecue ", " picnic " etc..Each context of the invention selects 100 related keywords.
3rd, recommendation server online processing step in place to go is:User's request is intercepted, parses user profile and context
Information, Similarity Measure is carried out based on linear interpolation, sequence similarity obtains recommendation results, specifically includes following steps:
Step 1:Request of the place to go recommendation server to user is intercepted and information parsing.
User's request bag contains ID, the configuration file of user, the current position of user and contextual information.
User profile is scoring of the user before to place to go, it is noted that place to go needs herein are can in database
With the place to go retrieved;The geographical position in the current position of user and above place to go need be under same measurement, be to letter
Breath is parsed, and is such as unified in longitude and latitude measurement;Contextual information is the specific dimension in server end processed offline step 4
Content.
Form is json.
Step 2:Place to go recommendation server carries out vectorization processing to user profile, by user interest configuration file and
The information MAP in place to go is in same feature describes coordinate system in database.
In this step, each user's structure includes the feature for representing that user interest is semantic of eight groups of vectors.Due to each
The configuration file of user will include multigroup " place to go indications, commenting star, customized label ".Present invention selection comments star more than dividing equally
Place to go as user positive interest express data.Each place to go includes eight vectors, be respectively title TFIDF semantemes to
Text is evaluated in amount, the LSI semantic vectors of title, the TFIDF semantic vectors of brief introduction, the LSI semantic vectors of brief introduction, front
LSI semantic vectors, TFIDF semantic vectors, the unfavorable ratings of unfavorable ratings text of TFIDF semantic vectors, front evaluation text
The LSI semantic vectors of text.Respectively by the word finder of the same vector correlation in different places to go included together as a new vector,
The value of new vector, this vectorial character representation as user are calculated afterwards.So far, user interest preference vector is obtained.
Meanwhile kept in the customized label of user as single characteristic.
Step 3:Place to go recommendation server carries out vectorization processing to context, and the front evaluation in context and place to go is reflected
Penetrate in same description coordinate system.
Corresponding to being retrieved in context section keyword dictionary corresponding in context in user's demand file
Keyword, together with keyword corresponding to all contexts and User Defined Label Merging in step 2, generation one " is used
Family characteristic describes text " (being substantially the list of word, the list is unordered).Simultaneously " user personality describes text " is carried out to
Quantify, IDF evaluates the IDF statistics of text set using the front in place to go during TFIDF is represented in vectorization procedure, and LSI also makes
Inferred with the LSI parameters of the front evaluation text set in place to go.So far, context vector is obtained.
Step 4:Place to go recommendation server in step 2 and step 3 based on illustrating above and below user interest preference vector sum
Literary vector, is calculated with the vector in place to go all in database, and " place to go " is calculated with " using by linear interpolation method
Family, context " to similarity.The linear difference formula for calculating similarity s (p, u) is as follows:
Wherein, p is place to go (place), and u is user (user), and c is (context), simfunc() is right for the two
Answer the cosine similarity of vector.Operation in V set mainly calculates the similarity relation in user interest preference and place to go, including:
The TFIDF semantic vectors of title, the LSI semantic vectors of title, the TFIDF semantic vectors of brief introduction, the LSI semantic vectors of brief introduction,
The TFIDF semantic vectors of front evaluation text, the LSI semantic vectors of front evaluation text, the TFIDF of unfavorable ratings text are semantic
Vector, the LSI semantic vectors of unfavorable ratings text }.simcontext_lsi(p, c) is used to calculate the potential of place to go and context vector
Semantic mapping lsi similarity relation, calculated using the corresponding vector of place to go front evaluation.simcontext_tfidf(p, c) is used
In the vocabulary tfidf similarity relations for calculating place to go and context vector, calculated using the corresponding vector of place to go front evaluation.
W is coefficient corresponding to each single item, and w is bigger, illustrate this to user to go between whether related influence is bigger.
Step 5:The similarity obtained according to step 4, recommend forward place to go of sorting, returning result.
Because this step simply carries out numerical ordering, can be, but not limited to using sort methods such as quicksort, heapsorts.
It is emphasized that embodiment of the present invention is illustrative, rather than it is limited, therefore present invention bag
Include and be not limited to embodiment described in embodiment, it is every by those skilled in the art's technique according to the invention scheme
The other embodiment drawn, also belongs to the scope of protection of the invention.