Natural language processing method, apparatus, equipment and medium based on human-computer interaction
Technical field
The present embodiments relate to field of computer technology more particularly to a kind of natural language processings based on human-computer interaction
Method, apparatus, equipment and medium.
Background technique
Human-computer interaction, which refers to, to be interacted between people and computer using specific natural language, and the mistake of information exchange is completed
Journey.With the fast development of artificial intelligence technology, human-computer interaction using more and more extensive, for example, business, household, education, section
The application of human-computer interaction is all referred in the fields such as skill and service, specific application product includes that independent intelligent interaction electronics is set
It is standby, such as knowledge question electronic equipment and intelligent customer service electronic equipment etc., it also include the intelligent interaction being integrated in various terminals
System.
Human-computer interaction often relates to specific session operational scenarios, and intelligence system needs to identify user speech, then
Provide reasonable response.Therefore, in the interactive system based on natural language, developer needs around specific product
Application scenarios access different dialogue ability and resource, to meet human-computer dialogue demand.
But in existing system, the exploitation of human-computer interaction is often individually carried out for each scene, needs to expend
Bigger human time's cost, reusability and scalability are poor.
Summary of the invention
The embodiment of the present invention provides a kind of natural language processing method, apparatus, electronic equipment and Jie based on human-computer interaction
Matter, to solve the problems, such as that high existing interactive system development cost and system multiplexing and scalability are poor.
In a first aspect, the embodiment of the invention provides a kind of natural language processing method based on human-computer interaction, this method
Include:
Intention assessment is carried out to target natural language text, obtains target intention and target slot position;
According to target intention and the resource pool pre-established, matching obtains target resource list, wherein in the resource pool
It include ability at least one target relevant to target intention in target resource list including multiple resources with different abilities
Resource;
Obtain the result set recalled from least one described target resource according to target intention and target slot position;
Target response words art corresponding with target natural language text is determined from the result set.
Second aspect, the embodiment of the invention also provides a kind of natural language processing device based on human-computer interaction, the dresses
It sets and includes:
Text identification module obtains target intention and target slot for carrying out intention assessment to target natural language text
Position;
Resource matched module, for matching and obtaining target resource list according to target intention and the resource pool pre-established,
Wherein, include multiple resources with different abilities in the resource pool, include ability and target intention in target resource list
At least one relevant target resource;
Result set obtains module, for obtaining according to target intention and target slot position from least one described target resource
The result set recalled;
The art that should answer determining module, for determining target corresponding with target natural language text from the result set
Should answer art.
The third aspect, the embodiment of the invention also provides a kind of electronic equipment, comprising:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device realizes the natural language processing method based on human-computer interaction as described in any embodiment of the present invention.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer
Program is realized when the program is executed by processor at the natural language based on human-computer interaction as described in any embodiment of the present invention
Reason method.
The ownership goal that the embodiment of the present invention is obtained according to identification is intended to and what is pre-established includes having different abilities
Multiple resource allocation ponds, matching obtain target resource list, then, obtain foundation ownership goal intention and target slot position from target
The result set recalled at least one corresponding target resource of the Resources list, finally, being determined from result set and target nature
The corresponding target response of language text talks about art.The embodiment of the present invention can solve existing interactive system development cost it is high and
System multiplexing and the poor problem of scalability, reduce the development cost of interactive system, improve system multiplexing and extension
Property.
Detailed description of the invention
Fig. 1 is the flow chart for the natural language processing method based on human-computer interaction that the embodiment of the present invention one provides;
Fig. 2 is the flow chart of the natural language processing method provided by Embodiment 2 of the present invention based on human-computer interaction;
Fig. 3 is the flow chart for the natural language processing method based on human-computer interaction that the embodiment of the present invention three provides;
Fig. 4 is the structural schematic diagram for the natural language processing device based on human-computer interaction that the embodiment of the present invention four provides;
Fig. 5 is the structural schematic diagram for a kind of electronic equipment that the embodiment of the present invention five provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just
Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is the flow chart for the natural language processing method based on human-computer interaction that the embodiment of the present invention one provides, this reality
It applies example and is applicable to the case where handling the natural language based on human-computer interaction, this method can be by based on human-computer interaction
Natural language processing device executes, which can be realized by the way of software and/or hardware, and can be integrated in electronics and set
Standby upper, which can be robot etc..As shown in Figure 1, this method specifically includes:
S110, intention assessment is carried out to target natural language text, obtains target intention and target slot position.
When user engages in the dialogue with electronic equipment to be interacted, electronic equipment collects user speech, utilizes itself processor
Natural language text is converted by user speech and carries out intention assessment, meanwhile, electronic equipment can also be by user's language of collection
Sound is sent to back-end server, and the intention assessment of user is carried out by back-end server.Intention assessment result include target intention and
Target slot position, wherein target intention indicates the core content in user's curent interrogation information, and target slot position can be understood as identifying
User is intended to essential additional key information.Such as: when user and electronic equipment engage in the dialogue, the language of user's output
Sound is " how is the weather of place X today? ", by intention assessment, the target intention of available user is inquiry weather, time
" today " and place " place X " i.e. target slot position, target intention and target slot position, which combine, just can accurately obtain user's intention.
In addition, it should be noted that, during user and electronic equipment interact, it is understood that there may be the feelings of more wheel dialogues
Condition, obtained ownership goal is intended to and target slot position is then in continuous and updates among variation, that is, needs to carry out the meaning of user
More wheels of figure recognition result are rewritten.For example, user inquires " today, how is weather ", then " tomorrow " is inquired, then second
During the intersection query of wheel, electronic equipment needs to rewrite user's intention assessment result, is converted to that " how is weather tomorrow
Sample ".This user is intended to the corresponding Intervention Mechanism of rewriting can be through entire request life cycle.
Optionally, intention assessment is being carried out to target natural language text, it, should before obtaining target intention and target slot position
Method further include:
Target natural language text is matched with the first default regular expression, if matched, is turned by artificial
Processing, wherein the first default regular expression is used to define the logic for needing manually to intervene human-computer interaction.
When the target natural language of user matches with the first default regular expression, i.e., electronic equipment cannot be identified successfully
User be intended to or electronic equipment can not the speech polling to user when carrying out response, then turn by artificial treatment, can be to avoid going out
The phenomenon that current family can not receive response, and interactive experience degree is caused to reduce.
It is exemplary, some sensitive events or sensitive vocabulary can be defined in the first default regular expression, when user's language
When the sensitive event involved in sound or sensitive vocabulary inquiry, just match, at this point, by manually answering user speech
It answers.Alternatively, electronic equipment can not identify when received user speech is more many and diverse, it is same to turn by manually carrying out response intervention.This
Outside, before manually being intervened, electronic equipment can export some pre-set templates and should answer art, such as " cannot manage
If solving you, see forgiving, turn manual answering later for you " or " if cannot understanding you, see forgiving, woulding you please redescribe "
Deng.It should be answered art by output template, can releive user emotion, improve the man-machine interaction experience of user.
S120, according to target intention and the resource pool pre-established, matching obtains target resource list, wherein resource pool
In include multiple resources with different abilities, include ability at least one mesh relevant to target intention in target resource list
Mark resource.
After identifying the target intention of user, target intention can be sent to back-end server by electronic equipment, rear
It holds and carries out resource matched in the resource pool of server, target resource list is obtained, so as to resource needed for subsequent recall.If it is rear
It holds server to carry out user's intention assessment, then can be carried out directly in resource pool resource matched.
Wherein, the resource pool pre-established includes multiple independent resources mutually, is related to extensive topic content, Ke Yiman
The resource transfer demand of sufficient different product and different dialogue scene.Each resource provides a kind of specific satisfaction for conversational system
Ability, such as navigation or stock etc., and multiple branch's child resources can be corresponding under each resource.Illustratively, resource
Resource involved in pond may include navigation, music, story, portrait, encyclopaedia, stock, constellation, bank, weather, film, joke
With chat etc., each resource is equivalent to a topic classification.These pools of resources together, can be convenient different product line selection
Specific resource is selected to be combined and be multiplexed.Each resource is independent mutually, can be convenient different developers and is absorbed in and intensively opens
The backend resources that hair oneself is responsible for maintenance, and final resource results are transferred to control frame in the unification of back-end server
Scheduling.
It should be noted that the resource pool provided in the present embodiment is distinct from usually said knowledge data base.It is existing
The resource type that is usually directed to of knowledge data base compare limitation, usually developer according to the application scenarios of specific product into
The matched exploitation of row, is only applicable in specific product, lacks transportable property and reusability.However, the resource pool in the present embodiment can
To carry out the development and maintenance of related resource respectively by different developers, it can satisfy different product line demands, have
Preferable transportable property and reusability.
In addition, by calling configurable resource pool in the present embodiment so that in human-computer interaction process required resource
With the existing search system that no longer places one's entire reliance upon, the coupling of search system and interactive system is reduced, and then is guaranteed
The stability and consistency of interactive system.Also, the application scenarios of existing search system and the applied field of conversational system
There are many differences for scape, directly can introduce search system parallel migration to conversational system unsuitable as a result, and the present embodiment
By calling the resource pool pre-established, while guaranteeing the versatility of conversational system, also avoid introducing inappropriate knot
Fruit.Furthermore if access existing search system in interactive system causes man-machine since the complicated access of access is longer
Conversational system engage in the dialogue response when it is whole time-consuming higher, the introducing for simultaneously scanning for system causes to talk with the problems in answering
Higher cost is checked, and this embodiment scheme gets rid of the dependence to existing search system, reduces a large amount of unnecessary calculating
Expense reduces the time-consuming of dialogue response and the cost of contingency question investigation.
Optionally, according to target intention and the resource pool pre-established, matching obtains target resource list, comprising:
If target intention and the second default regular expression matching, mask the specific resources in resource pool;
Based on the resource after shielding in resource pool, matching obtains the corresponding target resource list of target intention;
Wherein, the second default regular expression is for defining the logic for needing to shield specific resources.
Illustratively, the resource that the target intention of user is related to is stock, and the second default regular expression can be defined as
Mask at least one resource unrelated with stock.The particular content of second default regular expression can according to session operational scenarios into
Row configuration.It is shielded by the resource according to the second regular expression, it is possible to specify filter out unrelated resource, reduce rear end request
Pressure.
S130, the result set recalled from least one target resource according to target intention and target slot position is obtained.
After determining target resource list, result set, result set can be recalled from the target resource in resource pool
It is understood that be intended to and further screening of the target slot position in target resource according to ownership goal.
S140, target response words art corresponding with target natural language text is determined from result set.
It according to the result set of acquisition, generates target response and talks about art, and feed back to user.Illustratively, target natural language
User represented by text is intended that the weather of inquiry place X today, then the content for feeding back to the target response words art of user can
It is fine day with the weather for being place X today, 28 degree of temperature etc..
The main thought of technical solution provided in this embodiment is the general character for extracting interactive system, is taken out a set of
Frame is controlled in general conversational system, insertion different product and different application scene that can be parallel, in conjunction with concrete application scene
Parameter, the building of conversational system can be completed by configuration driving, provide high flexibility and scalability.It compares
Stand-alone development is carried out generally directed to different product lines in existing interactive system, system can be substantially improved in the present embodiment
Development efficiency, save a large amount of human time's costs.
The ownership goal that the present embodiment technical solution is obtained according to identification is intended to and what is pre-established includes having different energy
Multiple resource allocation ponds of power, matching obtain target resource list, then, obtain according to ownership goal be intended to and target slot position from
The result set recalled at least one corresponding target resource of target resource list, finally, being determined from result set and target
The corresponding target response of natural language text talks about art.The present embodiment technical solution solves existing interactive system development cost
High and system multiplexing and the poor problem of scalability, reduce the development cost of interactive system, it is multiple to improve system
With property, scalability and stability;Also, the present embodiment technical solution gets rid of the dependence to existing search system, reduces pair
The time-consuming for talking about response reduces the cost of contingency question investigation;Manual answering intervenes the setting for the art that should answer with template, ensure that
The man-machine interaction experience of user.
Embodiment two
Fig. 2 is the flow chart of the natural language processing method provided by Embodiment 2 of the present invention based on human-computer interaction, this reality
Applying example is further progress optimization on the basis of the above embodiments.As shown in Fig. 2, this method specifically includes:
S210, the in real time natural language text in acquisition human-computer interaction process.
Electronic equipment while obtaining User ID during obtaining the natural language text of user in real time, User ID with
There are one-to-one relationships for natural language text.User ID can be the characteristics of according to user speech, such as audio and sensual pleasure etc.,
The user identifier of generation.User speech content can be inquired according to User ID, otherwise is also set up.
S220, user is filtered according to User ID and default blacklist.
Developer can preset blacklist, and the associated user ID of filtering in need is stored on blacklist.It will acquire
Active user ID matched with preset blacklist, certain customers are filtered out according to matching result.It is come from if matched
Blacklist then executes S230, otherwise executes S240.
If S230, target natural language text come from the black list user of filtering, absolute object nature language is refused
Speech text carries out response.
When user belongs to the column of blacklist, which is filtered, and electronic equipment can be refused to its target natural language text
This carries out response.Subsequent operation is not performed.
S240, using error correcting model trained in advance, error correction is carried out to the natural language text currently got, obtains mesh
Mark natural language text, wherein error correcting model is the model trained in advance using the method for machine learning, for correcting nature language
Say the text mistake in text.
The natural language text and User ID for obtaining user in real time can if the user is not belonging to the column of blacklist
Continue that user is intended to identify.Wherein, before intention assessment, it can use preparatory trained error correcting model to user
Natural language text carry out error correction, from source guarantee intention assessment accuracy.Especially when user and electronic equipment into
When row talks with interaction at a distance, due to the influence of the sources of sound such as environmental noise, the far field discrimination of user speech is generally relatively low,
Text error correction is essential.Specific error correcting model can use any error correcting model in the prior art, and the present embodiment is to this
It is not especially limited.
S250, the contextual information for obtaining target natural language text and target natural language text, wherein context letter
Breath includes the intention assessment result of natural language text adjacent with target natural language text in human-computer interaction process.
In consideration human-computer interaction process, there are relevances for the content that the content talked with each time may talk with the last time.
Therefore, while obtaining the current goal natural language text of user, corresponding contextual information is obtained, is intended to know with auxiliary
Other progress.
S260, according to preconfigured intention assessment strategy, and according to contextual information, to target natural language text into
Row intention assessment obtains target intention and target slot position, wherein intention assessment strategy is pre-configured with based on current application scene
Strategy.
For different products and different application scenarios, it is intended that recognition strategy has differences.Specifically, intention assessment plan
The form for the program in machine code that can slightly encapsulate exists, can be real by configuring relevant parameter in the application scenarios of specific product
Now to the configuration of intention assessment strategy, and tactful corresponding program code itself is changed again without developer,
This demonstrates interactive system in the present embodiment again has very strong reusability and scalability.
Optionally, according to preconfigured intention assessment strategy, and according to contextual information, to target natural language text
Intention assessment is carried out, target intention and target slot position are obtained, comprising:
According to preconfigured intention assessment strategy, initial intention assessment is carried out to target natural language text, is obtained just
Beginning intention assessment result;
If initial intention assessment result has correlation with the intention assessment result in contextual information, according to up and down
Intention assessment result and initial intention assessment in literary information is as a result, determine target intention and target slot position;
If initial intention assessment result does not have correlation with the intention assessment result in contextual information, according to just
Beginning intention assessment result determines target intention and target slot position;
If cannot recognize that initial intention assessment as a result, if according to the intention assessment result and target in contextual information
Natural language text determines target intention and target slot position.
Wherein, according to intention assessment strategy, the initial intention assessment of user is obtained as a result, can be in conjunction with semantic correlation
Rule of judgment determines initial intention assessment result with information above with the presence or absence of correlation.If there is correlation, then context
Information can be used as the subsidiary conditions that identification user is intended to.In addition, when that cannot identify the initial intention assessment result of user, it can
With the association and conjecture according to contextual information and combination semanteme, the current target intention of user and target slot position are determined.It is above-mentioned
Three kinds of situations can flexibly be selected during specific user's intention assessment according to current session scene.
Optionally, if target intention and target slot position, this method can not be identified further include: utilize returning for training in advance
One changes model, carries out semantic normalization to target natural language text, wherein normalization creep function is the method using machine learning
Trained model in advance can recognize that the specification of intention is literary for will be incapable of recognizing that the natural language text of intention is converted to
This;
Intention assessment is carried out to the natural language text after normalization, obtains target intention and target slot position.
The voice of user's input is not any specification limit, and the speech habits of different user are also not quite similar.Cause
This can use normalization creep function to the target natural language text of user when the case where user is intended to can not be identified by occurring
It is normalized, then retransmits resource matched to back-end server progress.User's language is realized by this normalized
Justice amendment, can overcome the problems, such as it is unrecognized due to caused by the diversity of natural language expressing, and then guarantee it is subsequent
The recall rate of required resource.
S270, according to target intention and the resource pool pre-established, matching obtains target resource list, wherein resource pool
In include multiple resources with different abilities, include ability at least one mesh relevant to target intention in target resource list
Mark resource.
S280, the result set recalled from least one target resource according to target intention and target slot position is obtained.
S290, target response words art corresponding with target natural language text is determined from result set.
The present embodiment technical solution by obtaining the natural language text in human-computer interaction process in real time, according to User ID and
Default blacklist is filtered user, when user is not belonging to the column of blacklist, continues to identify user's intention, wherein can be with
Error correction is carried out to the user speech of acquisition using error correcting model, can also the target natural language text to user be normalized
Processing, obtains the target intention and target slot position of user in conjunction with intention assessment strategy;Then it is recalled from resource pool and required money
The relevant result set in source determines target response words art corresponding with target natural language text.The present embodiment technical solution solution
The existing interactive system development cost of having determined is high and system multiplexing and the poor problem of scalability, is guaranteeing to accurately identify
While user is intended to, the development cost of interactive system is reduced, system multiplexing, scalability and stability are improved.
Embodiment three
Fig. 3 is the flow chart for the natural language processing method based on human-computer interaction that the embodiment of the present invention three provides, this reality
Applying example is further progress optimization on the basis of the above embodiments.As shown in figure 3, this method specifically includes:
S310, intention assessment is carried out to target natural language text, obtains target intention and target slot position.
S320, according to preconfigured resource policy, the selected target resource set from resource pool, wherein resource policy is
Based on the preconfigured strategy of current application scene.
Specifically, the form for the program in machine code that resource policy can equally encapsulate exists, developer is according to current application
Scene realizes the configuration of resource policy, does not need to modify specific code by the way that resource parameters are arranged.According to being pre-configured with
Resource policy, can directly from backend resources pond selected target resource set, can also from by specific resources shielding after
Resource pool in selected target resource set.
S330, according to target intention, concentrate matching to obtain target resource list from target resource.
Wherein, target resource collection is selected, it is possible to understand that realize that the first of required resource screens according to resource policy again,
Then further according to target intention, matching target resource list is concentrated from target resource, second of resource needed for realizing is screened again.
S340, the knot recalled from the corresponding target resource of target resource list according to target intention and target slot position is obtained
Fruit collection.
S350, according to preconfigured adaptation strategies, the result in result set is fitted with target natural language text
Match, obtains at least one adaptation result, wherein adaptation strategies are based on the preconfigured strategy of current application scene.
Adaptation strategies can also exist in the form of program in machine code, real by the way that adaptation parameter is arranged according to current application scene
The configuration of existing adaptation strategies, it is not necessary to modify specific codes.By adaptation, it can further reject and be intended to unrelated letter with user
Breath, so that result more meets the demand of session operational scenarios.
Optionally, according to preconfigured adaptation strategies, by the result and the progress of target natural language text in result set
Adaptation obtains at least one adaptation result, comprising:
According to adaptation strategies and the target intention and target slot position of combining target natural language text, to every in result set
One result is extracted and is converted, and obtains at least one adaptation result, wherein adaptation strategies are for arranging to be suitble in man-machine friendship
The text representation of voice broadcast is carried out during mutually.
Result set is adapted to target natural language text, the extraction and transformation of result is specifically included, can make
As a result meet speech criterion, be convenient for voice broadcast.
S360, according to preconfigured ordering strategy, at least one adaptation result is ranked up, it is true according to ranking results
Set the goal the art that should answer, wherein ordering strategy is based on the preconfigured strategy of current application scene.
At least one obtained adaptation result can be understood as being intended to the candidate answer result set to match with user, according to
Preconfigured ordering strategy is ranked up result set, preferably chooses the preceding result that sorts as target response and talks about art.Its
In, ordering strategy exists similarly in the form of the program in machine code of encapsulation, and ordering strategy can be related according to being intended to user
Degree and resource Feasible degree are configured.The configuration process of strategy is also by configuring parameters sortnig, and it is not necessary to modify tactful generations
Code.For the different application scene of different product, there may be versatilities for ordering strategy, at this point, the ordering strategy can also be straight
Multiplexing is connect in other application scenarios.
Optionally, preconfigured ordering strategy includes at least text degree of correlation determination strategy and credible according to source resource
Spend the strategy given a mark;
Correspondingly, being ranked up at least one adaptation result, according to preconfigured ordering strategy according to ranking results
Determine that target response talks about art, comprising:
Pass through the text degree of correlation of judgement adaptation result and target natural language text, and the corresponding resource of adaptation result
The confidence level in source gives a mark to each adaptation result;
At least one adaptation result is ranked up according to marking result, is chosen according to ranking results and wherein meets default want
The adaptation asked is as a result, be determined as target response words art.
Wherein it is possible to determine that adaptation result is related to the text of target natural language text using similarity calculating method
Degree, the similarity result being calculated is higher, then the scoring of corresponding adaptation result is higher.For the confidence level of source resource,
Different confidence levels can be set according to resource stability with connected applications scene, for example, source resource includes different searches
Index holds up the database that determining results web page and real-time perfoming update, can using default setting as database it is with a high credibility in
The confidence level of results web page, when adaptation result derives from database, corresponding appraisal result is higher.The realization of scoring process can be with
It is that the marking program write in advance is called to carry out auto-scoring, is also possible to artificially give a mark, the present embodiment does not make this to have
Body limits.Be adapted to result score value determine after, be ranked up, can choose the preceding result of sequence as feeding back to user's
Target response talks about art.
Various strategies involved in above-mentioned are that can carry out parameter configuration realization according to concrete scene by developer
, compared with prior art, variation main in interactive system is moved on into configuration file from code.Different product lines is matched
Mutual independence is set, is independent of each other.Specific processing strategie is selected by configuring, and can quickly be replaced in the case where code is motionless
Change and be multiplexed Existing policies.Also, each interactive system only provides the treatment mechanism of respective stage, will not be to product line sheet
Body or access-in resource do any it is assumed that only having pre-defined the interface that relative strategy should be realized, thus by specific strategy
It realizes and is decoupled with mechanism.In different product lines, tactful realization side only needs to enable the reserved interface of interactive system, just
The customization demand of different product line may be implemented, then use corresponding plan by the way that the corresponding configuration file of product line is specified
Slightly, it can freely be combined replacement as part, provide high flexibility and scalability.
S370, to target response words art in pre-set text or character be filtered and correct, wherein pre-set text or word
The text or expression that symbol includes at least forbidden character, is not suitable for voice broadcast.
After determining target response words art, content or the forbidden character etc. that are wherein not suitable for carrying out voice broadcast are carried out
Filtering and amendment, so that the received response of user must standardize clearly content, guarantee the interactive experience of user.Wherein, right
Target response words art, which the Intervention Mechanisms such as is filtered and correct and is through, entirely requests life cycle.
The present embodiment technical solution is intended to identify to user first, then according to preconfigured resource policy, from
Selected target resource set in resource pool, and then according to the target intention of user, concentrate matching to obtain target resource from target resource
List is determined from the corresponding target resource of target resource list finally according to preconfigured adaptation strategies and ordering strategy
Target response talks about art out, further, it is also possible to which target response words art is filtered and is corrected.The present embodiment technical solution solves
Existing interactive system development cost is high and system multiplexing and the poor problem of scalability, reduces interactive system
Development cost, improve system multiplexing, scalability and stability.
Example IV
Fig. 4 is the structural schematic diagram for the natural language processing device based on human-computer interaction that the embodiment of the present invention four provides,
The present embodiment is applicable to the case where handling the natural language based on human-computer interaction.The device can using software and/
Or the mode of hardware is realized, and is configured on electronic equipment, such as robot etc..People is based on provided by the embodiment of the present invention
The natural language provided by any embodiment of the invention based on human-computer interaction can be performed in the natural language processing device of machine interaction
Processing method has the corresponding functional module of execution method and beneficial effect.
As shown in figure 4, the device includes text identification module 410, resource matched module 420, result set acquisition module 430
With the art determining module 440 that should answer, in which:
Text identification module 410 obtains target intention and target for carrying out intention assessment to target natural language text
Slot position;
Resource matched module 420, for according to target intention and the resource pool pre-established, matching to obtain target resource column
Table, wherein include multiple resources with different abilities in resource pool, include ability and target intention phase in target resource list
At least one target resource closed;
Result set obtains module 430, for obtaining according to target intention and target slot position from least one target resource
The result set recalled;
The art that should answer determining module 440, for determining target corresponding with target natural language text from result set
Should answer art.
Optionally, text identification module 410 includes text and context acquiring unit and intention assessment unit, in which:
Text and context acquiring unit, for obtain target natural language text and target natural language text up and down
Literary information, wherein contextual information includes natural language text adjacent with target natural language text in human-computer interaction process
Intention assessment result;
Intention assessment unit is used for according to preconfigured intention assessment strategy, and according to contextual information, certainly to target
Right language text carries out intention assessment, obtains target intention and target slot position, wherein intention assessment strategy is based on current application
The preconfigured strategy of scene.
Optionally, it is intended that recognition unit includes initial intention assessment subelement, the first determining subelement, the second determining son list
Member and third determine subelement, in which:
Initial intention assessment subelement, is used for according to preconfigured intention assessment strategy, to target natural language text
Initial intention assessment is carried out, initial intention assessment result is obtained;
First determines subelement, if the intention assessment result in initial intention assessment result and contextual information has
There is correlation, then according to the intention assessment result and initial intention assessment in contextual information as a result, determining target intention and mesh
Mark slot position;
Second determines subelement, if not for the intention assessment result in initial intention assessment result and contextual information
With correlation, then target intention and target slot position are determined according to initial intention assessment result;
Third determines subelement, for if cannot recognize that initial intention assessment as a result, if according in contextual information
Intention assessment result and target natural language text, determine target intention and target slot position.
On that basis of the above technical scheme, optionally, the device further include:
Module is obtained in real time, for obtaining the natural language text in human-computer interaction process in real time;
Correction module, for being entangled to the natural language text currently got using error correcting model trained in advance
Mistake obtains target natural language text, wherein error correcting model is the model trained in advance using the method for machine learning, is used for
Correct the text mistake in natural language text.
Optionally, the device further include:
Semanteme normalization module, if utilizing returning for training in advance for that can not identify target intention and target slot position
One changes model, carries out semantic normalization to target natural language text, wherein normalization creep function is the method using machine learning
Trained model in advance can recognize that the specification of intention is literary for will be incapable of recognizing that the natural language text of intention is converted to
This;
Correspondingly, text identification module 410 is specifically used for:
Intention assessment is carried out to the natural language text after normalization, obtains target intention and target slot position.
Optionally, resource matched module 420 includes that target resource collection selectes unit and first object the Resources list matching list
Member, in which:
Target resource collection selectes unit, is used for according to preconfigured resource policy, the selected target resource from resource pool
Collection;
First object the Resources list matching unit, for concentrating matching to obtain target from target resource according to target intention
The Resources list;
Wherein, resource policy is based on the preconfigured strategy of current application scene.
Optionally, the art determining module 440 that should answer includes adaptation unit and sort result unit, in which:
Adaptation unit is used for according to preconfigured adaptation strategies, by the result and target natural language text in result set
This is adapted to, at least one adaptation result is obtained;
Sort result unit, for being ranked up at least one adaptation result, root according to preconfigured ordering strategy
Determine that target response talks about art according to ranking results;
Wherein, adaptation strategies and ordering strategy are based on the preconfigured strategy of current application scene.
Optionally, adaptation unit is specifically used for:
According to adaptation strategies and the target intention and target slot position of combining target natural language text, to every in result set
One result is extracted and is converted, at least one adaptation result is obtained;
Wherein, adaptation strategies are used to arrange to be suitble to carry out the text representation of voice broadcast in human-computer interaction process.
Optionally, preconfigured ordering strategy includes at least text degree of correlation determination strategy and presses in sort result unit
The strategy given a mark according to source resource confidence level;
Correspondingly, sort result unit includes that result marking subelement and result choose subelement, in which:
As a result it gives a mark subelement, for the text degree of correlation by judgement adaptation result and target natural language text, with
And the confidence level of the corresponding source resource of adaptation result, it gives a mark to each adaptation result;
As a result subelement is chosen, for being ranked up according to marking result at least one adaptation result, is tied according to sequence
Fruit chooses the adaptation for wherein meeting preset requirement as a result, being determined as target response words art.
Optionally, which further includes;
Filtering module, for being filtered according to User ID and default blacklist to user;
Response refusal module is refused if coming from the black list user of filtering for target natural language text
Response is carried out to target natural language text.
Optionally, the device further include:
Artificial treatment matching module, for target natural language text to be matched with the first default regular expression,
If matched, turn by artificial treatment, wherein the first default regular expression for define needs manually to human-computer interaction into
The logic that row is intervened.
Optionally, resource matched module 420 further includes screen unit and the second target resource list match unit, in which:
Screen unit masks in resource pool if being used for target intention and the second default regular expression matching
Specific resources;
Second target resource list match unit, for based on the resource after shielding in resource pool, matching to obtain target meaning
Scheme corresponding target resource list;
Wherein, the second default regular expression is for defining the logic for needing to shield specific resources.
Optionally, the device further include:
Target response talk about art processing module, for target response words art in pre-set text or character be filtered and repair
Just, wherein pre-set text or character are including at least forbidden character, the text or expression of unsuitable voice broadcast.
The ownership goal that the present embodiment technical solution is obtained according to identification is intended to and what is pre-established includes having different energy
Multiple resource allocation ponds of power, matching obtain target resource list, then, obtain according to ownership goal be intended to and target slot position from
The result set recalled at least one corresponding target resource of target resource list, finally, being determined from result set and target
The corresponding target response of natural language text talks about art.The present embodiment technical solution solves existing interactive system development cost
High and system multiplexing and the poor problem of scalability, reduce the development cost of interactive system, it is multiple to improve system
With property and scalability.
Embodiment five
Fig. 5 is the structural schematic diagram for a kind of electronic equipment that the embodiment of the present invention five provides.Fig. 5, which is shown, to be suitable for being used in fact
The block diagram of the example electronic device 512 of existing embodiment of the present invention.The electronic equipment 512 that Fig. 5 is shown is only an example,
Should not function to the embodiment of the present invention and use scope bring any restrictions.
As shown in figure 5, electronic equipment 512 is showed in the form of universal electronic device.The component of electronic equipment 512 can wrap
Include but be not limited to: one or more processor 516, storage device 528 connect different system components (including storage device 528
With processor 516) bus 518.
Bus 518 indicates one of a few class bus structures or a variety of, including storage device bus or storage device control
Device processed, peripheral bus, graphics acceleration port, processor or total using the local of any bus structures in a variety of bus structures
Line.For example, these architectures include but is not limited to industry standard architecture (Industry Subversive
Alliance, ISA) bus, microchannel architecture (Micro Channel Architecture, MAC) bus is enhanced
Isa bus, Video Electronics Standards Association (Video Electronics Standards Association, VESA) local are total
Line and peripheral component interconnection (Peripheral Component Interconnect, PCI) bus.
Electronic equipment 512 typically comprises a variety of computer system readable media.These media can be it is any can be by
The usable medium that electronic equipment 512 accesses, including volatile and non-volatile media, moveable and immovable medium.
Storage device 528 may include the computer system readable media of form of volatile memory, such as arbitrary access
Memory (Random Access Memory, RAM) 530 and/or cache memory 532.Electronic equipment 512 can be into one
Step includes other removable/nonremovable, volatile/non-volatile computer system storage mediums.Only as an example, it stores
System 534 can be used for reading and writing immovable, non-volatile magnetic media (Fig. 5 do not show, commonly referred to as " hard disk drive ").
Although being not shown in Fig. 5, the disc driver for reading and writing to removable non-volatile magnetic disk (such as " floppy disk ") can be provided,
And to removable anonvolatile optical disk, such as CD-ROM (Compact Disc Read-Only Memory, CD-ROM),
Digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical mediums) read-write light
Disk drive.In these cases, each driver can pass through one or more data media interfaces and 518 phase of bus
Even.Storage device 528 may include at least one program product, which has one group of (for example, at least one) program mould
Block, these program modules are configured to perform the function of various embodiments of the present invention.
Program/utility 540 with one group of (at least one) program module 542 can store in such as storage dress
It sets in 528, such program module 542 includes but is not limited to operating system, one or more application program, other program moulds
It may include the realization of network environment in block and program data, each of these examples or certain combination.Program module
542 usually execute function and/or method in embodiment described in the invention.
Electronic equipment 512 (such as keyboard, can also be directed toward terminal, display 524 with one or more external equipments 514
Deng) communication, can also be enabled a user to one or more terminal interact with the electronic equipment 512 communicate, and/or with make
Any terminal that the electronic equipment 512 can be communicated with one or more of the other computing terminal (such as network interface card, modem
Etc.) communication.This communication can be carried out by input/output (I/O) interface 522.Also, electronic equipment 512 can also lead to
Cross network adapter 520 and one or more network (such as local area network (Local Area Network, LAN), wide area network
(Wide Area Network, WAN) and/or public network, such as internet) communication.As shown in figure 5, network adapter 520
It is communicated by bus 518 with other modules of electronic equipment 512.It should be understood that although not shown in the drawings, can be set in conjunction with electronics
Standby 512 use other hardware and/or software module, including but not limited to: microcode, terminal driver, redundant processor, outside
Disk drive array, disk array (Redundant Arrays of Independent Disks, RAID) system, tape drive
Dynamic device and data backup storage system etc..
The program that processor 516 is stored in storage device 528 by operation, thereby executing various function application and number
According to processing, such as realize the natural language processing method provided by any embodiment of the invention based on human-computer interaction, this method
May include:
Intention assessment is carried out to target natural language text, obtains target intention and target slot position;
According to target intention and the resource pool pre-established, matching obtains target resource list, wherein includes in resource pool
Multiple resources with different abilities include that ability at least one target relevant to target intention provides in target resource list
Source;
Obtain the result set recalled from least one target resource according to target intention and target slot position;
Target response words art corresponding with target natural language text is determined from result set.
Embodiment six
The embodiment of the present invention six additionally provides a kind of computer readable storage medium, is stored thereon with computer program, should
Such as the natural language processing side provided by any embodiment of the invention based on human-computer interaction is realized when program is executed by processor
Method, this method may include:
Intention assessment is carried out to target natural language text, obtains target intention and target slot position;
According to target intention and the resource pool pre-established, matching obtains target resource list, wherein includes in resource pool
Multiple resources with different abilities include that ability at least one target relevant to target intention provides in target resource list
Source;
Obtain the result set recalled from least one target resource according to target intention and target slot position;
Target response words art corresponding with target natural language text is determined from result set.
The computer storage medium of the embodiment of the present invention, can be using any of one or more computer-readable media
Combination.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readable
Storage medium for example may be-but not limited to-the system of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, device or
Device, or any above combination.The more specific example (non exhaustive list) of computer readable storage medium includes: tool
There are electrical connection, the portable computer diskette, hard disk, random access memory (RAM), read-only memory of one or more conducting wires
(ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-
ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this document, computer-readable storage
Medium can be any tangible medium for including or store program, which can be commanded execution system, device or device
Using or it is in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited
In wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof
Program code, described program design language include object oriented program language-such as Java, Smalltalk, C++, also
Including conventional procedural programming language-such as " C " language or similar programming language.Program code can be complete
Ground executes on the user computer, partly executes on the user computer, executing as an independent software package, partially existing
Part executes on the remote computer or executes on remote computer or terminal completely on subscriber computer.It is being related to far
In the situation of journey computer, remote computer can pass through the network of any kind --- including local area network (LAN) or wide area network
(WAN)-it is connected to subscriber computer, or, it may be connected to outer computer (such as led to using ISP
Cross internet connection).
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that
The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,
It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention
It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also
It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.