CN107203504A - Character string replacement method and device - Google Patents

Character string replacement method and device Download PDF

Info

Publication number
CN107203504A
CN107203504A CN201710351638.3A CN201710351638A CN107203504A CN 107203504 A CN107203504 A CN 107203504A CN 201710351638 A CN201710351638 A CN 201710351638A CN 107203504 A CN107203504 A CN 107203504A
Authority
CN
China
Prior art keywords
word
replaced
paste
clip
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710351638.3A
Other languages
Chinese (zh)
Other versions
CN107203504B (en
Inventor
朱德伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710351638.3A priority Critical patent/CN107203504B/en
Publication of CN107203504A publication Critical patent/CN107203504A/en
Application granted granted Critical
Publication of CN107203504B publication Critical patent/CN107203504B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)

Abstract

This application discloses character string replacement method and device.One embodiment of this method includes:In response to detecting point operation of the user to target text, extract the character string in the preset range of the position in the target text pointed by the user, the character string extracted is defined as character string to be replaced, and extraction is pre-stored within clipbook and clips and pastes character string;Character string progress participle is cliped and pasted to this and clips and pastes set of words to generate, and the character string to be replaced is carried out participle to generate set of words to be replaced;Set of words is cliped and pasted to this and the set of words to be replaced is parsed, determine this clip and paste the target in set of words clip and paste it is in word and the set of words to be replaced, with the target clip and paste the target word to be replaced that word matches;Target word to be replaced in the character string to be replaced is replaced with into the target and clips and pastes word.The embodiment reduces human cost, improves the efficiency of text-processing.

Description

Character string replacement method and device
Technical field
The application is related to field of computer technology, and in particular to Internet technical field, more particularly to character string replacement side Method and device.
Background technology
User often uses the function of replicating and paste during mobile device or computer is used.Generally, need Some character string is first replicated, then carries out manually affixing to specified location;Or choose some original character string, then artificial progress Paste, to realize the replacement of character string.
However, in the case where character to be replaced is more, manually searching character string to be replaced if relying on, not only manpower Cost is higher, there is also text-processing it is less efficient the problem of.
The content of the invention
The purpose of the embodiment of the present application is to propose a kind of improved character string replacement method and device, to solve the above back of the body The technical problem that scape technology segment is mentioned.
In a first aspect, the embodiment of the present application provides a kind of character string replacement method, this method includes:In response to detecting User extracts the preset range in the position pointed by user described in the target text to the point operation of target text Interior character string, character string to be replaced is defined as by the character string extracted, and extraction is pre-stored within cliping and pasting in clipbook Character string;Participle is carried out to cliping and pasting character string and to generate clips and pastes set of words, and treats substitute character string and carries out participle and treated with generating Replace set of words;Parsed to cliping and pasting set of words and set of words to be replaced, it is determined that the target cliped and pasted in set of words clip and paste word and In set of words to be replaced and target clips and pastes the target word to be replaced that word matches;Target in character string to be replaced is waited to replace Change word and replace with target and clip and paste word.
In certain embodiments, parsed to cliping and pasting set of words and set of words to be replaced, it is determined that cliping and pasting in set of words Target clips and pastes in word and set of words to be replaced and target and clips and pastes the target word to be replaced that word matches, including:Extract default Multiple near synonym groups, wherein, each near synonym group in multiple near synonym groups includes multiple words of near synonym each other;For cutting Each in patch set of words clips and pastes word, by it is in multiple near synonym groups, there are near synonym that the word that word matches is cliped and pasted with this Group as target near synonym group, seriatim by each word to be replaced in set of words to be replaced with it is in target near synonym group, remove The word for cliping and pasting beyond word is matched, in response to determining to have the word to be replaced that the match is successful in set of words to be replaced, by institute Determine that the word to be replaced that the match is successful is defined as cliping and pasting the target word to be replaced that word matches with this, and this is cliped and pasted into word determination Word is cliped and pasted for target.
In certain embodiments, parsed to cliping and pasting set of words and set of words to be replaced, it is determined that cliping and pasting in set of words Target clips and pastes in word and set of words to be replaced and target and clips and pastes the target word to be replaced that word matches, including:Extract default Multiple similar phrases, wherein, each similar phrase in multiple similar phrases includes belonging to same type of multiple words;For Each cliped and pasted in set of words clips and pastes word, by it is in multiple similar phrases, exist and clip and paste the similar of the word that word matches with this Phrase as the similar phrase of target, seriatim by it is in each word to be replaced phrase similar with target in set of words to be replaced, Word in addition to this clips and pastes word is matched, in response to determining to have the word to be replaced that the match is successful in set of words to be replaced, will The identified word to be replaced that the match is successful is defined as cliping and pasting the target word to be replaced that word matches with this, and to clip and paste word true by this It is set to target and clips and pastes word.
In certain embodiments, parsed to cliping and pasting set of words and set of words to be replaced, it is determined that cliping and pasting in set of words Target clips and pastes in word and set of words to be replaced and target and clips and pastes the target word to be replaced that word matches, including:It is determined that cliping and pasting word Each in set clips and pastes the term vector of each word to be replaced in the term vector and set of words to be replaced of word;For cliping and pasting word set Each in conjunction clips and pastes word, and this is cliped and pasted to the term vector of word as target term vector, determines that target term vector is waited to replace with each The similarity of the term vector of word is changed, in response to determining that the similarity that there is term vector and target term vector in set of words to be replaced is big In the word to be replaced of default similarity threshold, this is cliped and pasted into word it is defined as specifying and clip and paste word, and will identified word to be replaced It is defined as cliping and pasting the specified word to be replaced that word matches with specifying;For it is identified each specify and clip and paste word, based on default Near synonym group, determine that this is specified and clip and paste word and specify that to clip and paste the specified word to be replaced that word matches whether near each other adopted with this Word, target word to be replaced is defined as if so, will be specified with this and clip and paste the specified word to be replaced that word matches, and this specified is cliped and pasted Word is defined as target and clips and pastes word.
In certain embodiments, word is cliped and pasted this is cliped and pasted into word being defined as specifying, and identified word to be replaced is determined For with specify and clip and paste the specified word to be replaced that word matches after, parsed to cliping and pasting set of words and set of words to be replaced, really Surely clip and paste the target in set of words and clip and paste that in word and set of words to be replaced, that the target that word matches is cliped and pasted with target is to be replaced Word, in addition to:For it is identified each specify clip and paste word, based on default similar phrase, determine this specify clip and paste word and Specified with this and clip and paste whether the specified word to be replaced that word matches belongs to same type, if so, specified word phase will be cliped and pasted with this The specified word to be replaced matched somebody with somebody is defined as target word to be replaced, and this is specified to clip and paste word and be defined as target clips and pastes word.
In certain embodiments, this method, in addition to:For it is identified each specify clip and paste word, in response to determine This is specified to clip and paste word and specify with this and clips and pastes the specified word to be replaced that word matches and be not belonging to same near synonym group and be not belonging to Same similar phrase, generates to be specified by this and clips and pastes word and specify clip and paste that the specified word to be replaced that word matches constitutes near with this Adopted phrase, and by it is in character string to be replaced, specify with this to clip and paste the specified word to be replaced that word matches and replace with this and specified cut Paste word.
Second aspect, the embodiment of the present application provides a kind of character string alternative, and the device includes:Extraction unit, matches somebody with somebody Put in response to detecting point operation of the user to target text, extracting the position being in target text pointed by user Preset range in character string, the character string extracted is defined as character string to be replaced, and extract to be pre-stored within and clip and paste Character string is cliped and pasted in plate;Participle unit, is configured to carry out participle to cliping and pasting character string to generate to clip and paste set of words, and treats Substitute character string carries out participle to generate set of words to be replaced;Resolution unit, is configured to cliping and pasting set of words and word to be replaced Set parsed, it is determined that the target cliped and pasted in set of words clip and paste it is in word and set of words to be replaced, word phase is cliped and pasted with target The target word to be replaced matched somebody with somebody;First replacement unit, is configured to the target word to be replaced in character string to be replaced replacing with mesh Mark clips and pastes word.
In certain embodiments, resolution unit includes:First extraction module, is configured to extract default multiple near synonym Group, wherein, each near synonym group in multiple near synonym groups includes multiple words of near synonym each other;First determining module, matches somebody with somebody Put for for clip and paste each in set of words clip and paste word, by it is in multiple near synonym groups, exist and clip and paste word with this and match Word near synonym group as target near synonym group, it is seriatim that each word to be replaced and target in set of words to be replaced is closely adopted Word in phrase, in addition to this clips and pastes word is matched, in response to determining in set of words to be replaced in the presence for the treatment of that the match is successful Substitute, the identified word to be replaced that the match is successful is defined as to clip and paste the target word to be replaced that word matches with this, and will This, which is cliped and pasted word and is defined as target, clips and pastes word.
In certain embodiments, resolution unit includes:Second extraction module, is configured to extract default multiple similar words Group, wherein, each similar phrase in multiple similar phrases includes belonging to same type of multiple words;Second determining module, Be configured to for clip and paste each in set of words clip and paste word, by it is in multiple similar phrases, exist and clip and paste word phase with this The similar phrase for the word matched somebody with somebody is seriatim same by each word to be replaced and target in set of words to be replaced as the similar phrase of target Word in class phrase, in addition to this clips and pastes word is matched, in response to determining to have what the match is successful in set of words to be replaced Word to be replaced, the identified word to be replaced that the match is successful is defined as to clip and paste the target word to be replaced that word matches with this, and This is cliped and pasted into word it is defined as target and clips and pastes word.
In certain embodiments, resolution unit includes:3rd determining module, is configured to determine to clip and paste each in set of words The term vector of each word to be replaced in the individual term vector for cliping and pasting word and set of words to be replaced;4th determining module, is configured to For clip and paste each in set of words clip and paste word, this is cliped and pasted to the term vector of word as target term vector, determine target word to Amount and the similarity of the term vector of each word to be replaced, in response to determine to exist in set of words to be replaced term vector and target word to The similarity of amount is more than the word to be replaced of default similarity threshold, this is cliped and pasted into word is defined as specifying and clip and paste word, and by really Fixed word to be replaced is defined as cliping and pasting the specified word to be replaced that word matches with specifying;5th determining module, be configured to for It is identified each specify clip and paste word, based on default near synonym group, determine this specify clip and paste word and with this specify clip and paste word The specified word to be replaced matched whether each other near synonym, if so, cliping and pasting the specified word to be replaced that word matches by being specified with this It is defined as target word to be replaced, and this is specified to clip and paste word and be defined as target clips and pastes word.
In certain embodiments, resolution unit also includes:6th determining module, be configured to for it is identified each Specify and clip and paste word, based on default similar phrase, determine that this is specified and clip and paste word and specify clip and paste that word matches specified to treat with this Whether substitute belongs to same type, is treated if so, will specify to clip and paste the specified word to be replaced that word matches and be defined as target with this Substitute, and this is specified to clip and paste word and be defined as target clip and paste word.
In certain embodiments, the device also includes:Second replacement unit, be configured to for it is identified each refer to Surely clip and paste word, in response to determine this specify clip and paste word and specified with this clip and paste the specified word to be replaced that word matches be not belonging to it is same Individual near synonym group and same similar phrase is not belonging to, generation is specified to clip and paste word and specify with this by this clips and pastes the finger that word matches The near synonym group that fixed word to be replaced is constituted, and by it is in character string to be replaced, with this it is specified clip and paste that word matches specified wait to replace Change word replace with this specify clip and paste word.
The third aspect, the embodiment of the present application provides a kind of terminal device, and the terminal device includes:One or more processing Device;Storage device, for storing one or more programs, when one or more programs are executed by one or more processors, makes One or more processors are obtained to realize such as the method for any embodiment in above-mentioned character string replacement method.
Character string replacement method and device that the embodiment of the present application is provided, by response to detecting user to target text The character string for performing operation, extracting in the preset range of the position described in the target text pointed by user, and by institute The character string of extraction is defined as character string to be replaced, then to extracted be pre-stored within clipbook clip and paste character string and Character string to be replaced carries out participle, and set of words and set of words to be replaced are cliped and pasted to generate respectively, then to clip and paste set of words and Set of words to be replaced is parsed, and determines that target clips and pastes word and target word to be replaced, finally by the target in character string to be replaced Word to be replaced replaces with target and clips and pastes word, without manually entering edlin and replacement, reduces human cost, improves text The efficiency of present treatment.
Brief description of the drawings
By reading the detailed description made to non-limiting example made with reference to the following drawings, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is that the application can apply to exemplary system architecture figure therein;
Fig. 2 is the flow chart of one embodiment of the character string replacement method according to the application;
Fig. 3 is the schematic diagram of an application scenarios of the character string replacement method according to the application;
Fig. 4 is the flow chart of another embodiment of the character string replacement method according to the application;
Fig. 5 is the structural representation of one embodiment of the character string alternative according to the application;
Fig. 6 is adapted for the structural representation of the computer system of the terminal device for realizing the embodiment of the present application.
Embodiment
The application 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 related invention, rather than the restriction to the invention.It also should be noted that, in order to Be easy to description, illustrate only in accompanying drawing to about the related part of invention.
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phase Mutually combination.Describe the application in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Fig. 1 shows the example system frame of the character string replacement method or character string alternative that can apply the application Structure 100.
As shown in figure 1, system architecture 100 can include terminal device 101,102,103, network 104 and server 105. Medium of the network 104 to provide communication link between terminal device 101,102,103 and server 105.Network 104 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
Terminal device 101,102,103 is interacted by network 104 with server 105, to receive or send message etc..Terminal Various telecommunication customer end applications, such as application of text editing class, reading class application can be installed in equipment 101,102,103 Deng.Terminal device 101,102,103 can carry out participle, parsing, replacement etc. to user's duplication, the character string chosen and pointed to Reason.
Terminal device 101,102,103 can be with display screen and support the various electronic equipments of text editing, bag Include but be not limited to smart mobile phone, tablet personal computer, E-book reader, pocket computer on knee and desktop computer etc..
Server 105 can be to provide the server of various services, for example, be stored on terminal device 101,102,103 Dictionary provide support management server.Management server can be to the dictionary that is stored on terminal device 101,102,103 The operation such as it is updated, manages.
It should be noted that above-mentioned terminal device 101,102,103 can also directly carry out the behaviour such as renewal, management of dictionary Make, at this point it is possible to which server 105 and network 104 is not present.
It should be noted that the character string replacement method that is provided of the embodiment of the present application it is general by terminal device 101,102, 103 are performed, and correspondingly, character string alternative is generally positioned in terminal device 101,102,103.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only schematical.According to realizing need Will, can have any number of terminal device, network and server.
With continued reference to Fig. 2, the flow 200 of one embodiment of character string replacement method according to the application is shown.Institute The character string replacement method stated, comprises the following steps:
Step 201, in response to detecting point operation of the user to target text, extract in target text pointed by user Position preset range in character string, the character string extracted is defined as character string to be replaced, and extract and prestore Character string is cliped and pasted in clipbook.
In the present embodiment, electronic equipment (such as terminal device shown in Fig. 1 of character string replacement method operation thereon 101st, 102,103) can be provided with that the user that can be stored with clipbook, above-mentioned clipbook replicates in advance clips and pastes character string. Above-mentioned electronic equipment can also show text, after user chooses some region or paragraph in shown text, above-mentioned electricity The region or paragraph that sub- equipment can be chosen above-mentioned user are defined as target text.In practice, above-mentioned clipbook is internal memory In one piece of region, can between various application programs, transmit and shared information.
In the present embodiment, above-mentioned electronic equipment, can in response to detecting point operation of the user to above-mentioned target text The character string in preset range to extract the position in above-mentioned target text pointed by above-mentioned user, by the character string extracted It is defined as character string to be replaced, and extraction is pre-stored within clipbook and clips and pastes character string.Herein, above-mentioned point operation can be with It is that mouse pointer or cursor are moved in the operation or user's click or pressing of a certain position in above-mentioned target text State the operation of a certain position in the above-mentioned target text that the touch-screen of electronic equipment is shown.It should be noted that above-mentioned default Scope can be the model that is constituted of character (such as 5 or 10) of the front and rear predetermined number of the position pointed by user Enclose.As an example, target text is " small to be organized in the ten big taboos for bringing little chap schoolgirl to wear the clothes to you here ", user points to position It is position where character " female " to put, and preset range is the character string that is constituted of front and rear 3 characters of the position pointed by user Scope, then the character string in above-mentioned preset range then be " little chap schoolgirl wears the clothes ".
Step 202, carrying out participle to cliping and pasting character string to generate clips and pastes set of words, and treats substitute character string and carry out participle To generate set of words to be replaced.
In the present embodiment, above-mentioned electronic equipment can carry out participle using various participle modes to above-mentioned character string of cliping and pasting Set of words is cliped and pasted to generate, and above-mentioned character string to be replaced is carried out participle to generate set of words to be replaced.
In some optional implementations of the present embodiment, above-mentioned segmenting method can be the participle side based on statistics Method.Specifically, adjacent character is constituted in character string and above-mentioned character string to be replaced character combination can be cliped and pasted to above-mentioned Frequency is counted, and calculates the frequency of character combination appearance.When said frequencies are higher than predeterminated frequency threshold value, then judge above-mentioned Combination constitutes word, so as to realize to the above-mentioned participle for cliping and pasting character string and above-mentioned character string to be replaced.
In some optional implementations of the present embodiment, above-mentioned segmenting method can also be former based on string matching The segmenting method of reason.Specifically, it is possible to use string matching principle clips and pastes character string and above-mentioned word to be replaced by above-mentioned respectively Symbol string is matched with each word in the machine dictionary being preset in above-mentioned electronic equipment respectively, wherein, above-mentioned character string It can be Forward Maximum Method method, reverse maximum matching method with principle, set up cutting mark method, travel through matching method, forward direction by word Best Match Method or reverse Best Match Method etc..
In some optional implementations of the present embodiment, above-mentioned electronic equipment can utilize hidden Markov model (Hidden Markov Model, HMM) carries out the above-mentioned participle for cliping and pasting character string and above-mentioned character string to be replaced.With to above-mentioned Clip and paste exemplified by character string progress participle, above-mentioned electronic equipment can determine to constitute the five-tuple of above-mentioned Markov model first, Above-mentioned five-tuple includes observable sequence, hidden state set, initial state space probability, state-transition matrix and observation probability Distribution matrix.Wherein, above-mentioned observable sequence is above-mentioned to clip and paste character string;Above-mentioned hidden state set can comprising individual character into In word, prefix, word, four kinds of states of suffix;Above-mentioned initial state space probability can be each state in hidden state set The initial probability distribution in preset dictionary;Above-mentioned state-transition matrix can be used for characterizing above-mentioned clip and paste in character string often The state transition probability of individual character (such as being changed as prefix to individual character into the probability of word);Above-mentioned observation probability distribution matrix is used In the probability for each character being characterized under each state.Afterwards, above-mentioned electronic equipment can carry out state mark for each character Note, and determine based on viterbi algorithm the maximum probability state of each character.Finally, can the maximum probability based on each character State, carries out the above-mentioned cutting for cliping and pasting character string, obtains cliping and pasting set of words.
It should be noted that above-mentioned various segmenting methods are widely studied at present and application known technologies, herein no longer Repeat.
Step 203, parsed to cliping and pasting set of words and set of words to be replaced, it is determined that the target cliped and pasted in set of words is cliped and pasted In word and set of words to be replaced and target clips and pastes the target word to be replaced that word matches.
In the present embodiment, above-mentioned electronic equipment can be cliped and pasted set of words and above-mentioned treated using various analysis methods to above-mentioned Replace set of words parsed, determine the above-mentioned target cliped and pasted in set of words clip and paste it is in word and above-mentioned set of words to be replaced, and Above-mentioned target clips and pastes the target word to be replaced that word matches.As an example, above-mentioned electronic equipment can be utilized clips and pastes word to above-mentioned The mode that word in set carries out Similarity Measure with the word in above-mentioned set of words to be replaced determines that each clips and pastes word and each is replaced The similarity of word is changed, the word of cliping and pasting in one group of maximum word of similarity is defined as target and clips and pastes word, and by treating in this group of word Substitute is defined as target word to be replaced;In addition, above-mentioned electronics, which is set, to clip and paste word by user's input or the above-mentioned of selection Some word in set, which clips and pastes word and is defined as target, clips and pastes word, and by user inputs or selects above-mentioned set of words to be replaced Some word is defined as cliping and pasting the target word to be replaced that word matches with the target.
In some optional implementations of the present embodiment, user can be previously stored with above-mentioned electronic equipment advance The multiple near synonym groups set, wherein, each near synonym group in above-mentioned multiple near synonym groups includes many of near synonym each other Individual word.For example, some near synonym group, which includes word " liking " and word " liking ", another near synonym group, includes word " short Son " and word " little chap " etc..Above-mentioned electronic equipment can extract default above-mentioned multiple near synonym groups, and word is cliped and pasted for above-mentioned Each in set clips and pastes word, can perform following steps:
It is possible, firstly, to by it is in above-mentioned multiple near synonym groups, to there is the near synonym group of cliping and pasting the word that word matches with this true It is set to target near synonym group.As an example, above-mentioned multiple near synonym groups are served as reasons respectively, word " liking " and word " liking " are constituted The first near synonym group, the second near synonym group for being made up of word " short person " and word " little chap ".It is above-mentioned to clip and paste set of words In comprising cliping and pasting word " short person ".Above-mentioned electronic equipment this can be cliped and pasted word " short person " seriatim with above-mentioned first near synonym Word in group and above-mentioned second near synonym group is matched.In this example, exist in above-mentioned second near synonym group and cliped and pasted with this The word that word " short person " matches, thus, for this clips and pastes word " short person ", above-mentioned second near synonym group can be determined The corresponding target near synonym group of word " short person " is cliped and pasted for this.
Afterwards, above-mentioned electronic equipment can be seriatim by each word to be replaced in above-mentioned set of words to be replaced and above-mentioned mesh In the mark near synonym group, word in addition to this clips and pastes word is matched.By taking above-mentioned example as an example, it can be wrapped in set of words to be replaced Containing word to be replaced " little chap ", word to be replaced " schoolgirl " and word to be replaced " wearing the clothes ".Above-mentioned electronic equipment can seriatim will be upper State in word to be replaced " little chap ", above-mentioned word " schoolgirl " to be replaced and above-mentioned word to be replaced " wearing the clothes " and above-mentioned second near synonym group , the word (i.e. word " little chap ") in addition to word " short person " matched.
Finally, in response to determining to have the word to be replaced that the match is successful, above-mentioned electronic equipment in above-mentioned set of words to be replaced The identified word to be replaced that the match is successful can be defined as cliping and pasting the target word to be replaced that word matches with this, and this is cut Patch word is defined as target and clips and pastes word.By taking above-mentioned example as an example, the target near synonym group corresponding with cliping and pasting word " short person " is upper State the second near synonym group.Seriatim by the word to be replaced " little chap " in above-mentioned set of words to be replaced, word to be replaced " schoolgirl " After being matched successively with the word " little chap " in above-mentioned second near synonym group with word to be replaced " wearing the clothes ", above-mentioned electronic equipment It can determine there is the word to be replaced " little chap " that the match is successful in above-mentioned set of words to be replaced.Above-mentioned electronic equipment will can be somebody's turn to do Word " little chap " to be replaced is defined as cliping and pasting the target word to be replaced that word " short person " matches with above-mentioned, and this is cliped and pasted into word " little chap " is defined as target and clips and pastes word.
In some optional implementations of the present embodiment, user can be previously stored with above-mentioned electronic equipment advance The multiple similar phrases set, wherein, each similar phrase in above-mentioned multiple similar phrases includes belonging to same type of Multiple words.For example, some similar phrase include for indicator variable type word " Integer " and word " String ", separately One near synonym group includes belonging to word " apple " and word " watermelon " of fruit etc..It should be noted that each similar word The same type of multiple words that belong in group can also be the multiple words for being used to describe same target that user pre-sets, example Such as, some similar phrase includes word " red apple " and word " granny smith ".Above-mentioned electronic equipment can extract default above-mentioned Multiple similar phrases, word is cliped and pasted for each above-mentioned cliped and pasted in set of words, can perform following steps:It is possible, firstly, to carry Take default above-mentioned multiple similar phrases;Then, word is cliped and pasted for each above-mentioned cliped and pasted in set of words, will be above-mentioned multiple same It is in class phrase, there is the similar phrase for cliping and pasting the word that word matches with this as the similar phrase of target, seriatim treated above-mentioned In each word to be replaced phrase similar with above-mentioned target in the set of words, word in addition to this clips and pastes word is replaced to be matched, In response to determining to have the word to be replaced that the match is successful in above-mentioned set of words to be replaced, that the match is successful is to be replaced by identified Word is defined as cliping and pasting the target word to be replaced that word matches with this, and this is cliped and pasted into word is defined as target and clip and paste word.Need explanation , it is above-mentioned to determine that target is cliped and pasted the method for word and target word to be replaced and determined with above-mentioned based on synonymous phrase based on similar phrase Target clips and pastes word and the method for target word to be replaced is essentially identical, will not be repeated here.
Step 204, the target word to be replaced in character string to be replaced is replaced with into target and clips and pastes word.
In the present embodiment, above-mentioned electronic equipment can replace with the target word to be replaced in above-mentioned character string to be replaced Corresponding target clips and pastes word.As an example, above-mentioned character string to be replaced is " little chap schoolgirl wears the clothes ", target word to be replaced is " little chap ", target clips and pastes word for " short person ", and above-mentioned electronic equipment can " little chap schoolgirl wears by above-mentioned character string to be replaced Character string " little chap " in clothing " is substituted for " short person ", the character string " short person schoolgirl wears the clothes " after being replaced.
With continued reference to Fig. 3, Fig. 3 is a schematic diagram of the application scenarios of the character string replacement method according to the present embodiment. In Fig. 3 application scenarios, user have selected target text 301 first, and point to character " female " institute in target text 301 Position.Then, front and rear three characters of the position in terminal device extraction target text 301 pointed by user are constituted The character string of scope, i.e. character string " little chap schoolgirl wears the clothes ", the character string " little chap schoolgirl wears the clothes " are defined as to be replaced Character string, and extract and be pre-stored within clipbook and clip and paste character string.Afterwards, terminal device clips and pastes character string to above-mentioned respectively " short person classmate " and above-mentioned character string to be replaced " little chap schoolgirl wears the clothes " carry out participle, and generation clips and pastes set of words and to be replaced Set of words.Then, terminal device clips and pastes set of words and above-mentioned set of words to be replaced is parsed to above-mentioned, determines above-mentioned to clip and paste word Target in set clips and pastes in word " short person " and above-mentioned set of words to be replaced and above-mentioned target and clips and pastes the target that word matches Word " little chap " to be replaced.Finally, by the above-mentioned target word to be replaced in above-mentioned character string " little chap schoolgirl wears the clothes " to be replaced " little chap " replaces with above-mentioned target and clips and pastes word " short person ".
The method that above-described embodiment of the application is provided, performs operation to target text in response to detecting user, carries The character string in the preset range of the position in above-mentioned target text pointed by above-mentioned user is taken, and the character string extracted is true Be set to character string to be replaced, then to extracted be pre-stored within clipbook clip and paste character string and character string to be replaced is entered Row participle, set of words and set of words to be replaced are cliped and pasted to generate respectively, are then entered to cliping and pasting set of words and set of words to be replaced Row parsing, determines that target clips and pastes word and target word to be replaced, finally replaces with the target word to be replaced in character string to be replaced Target clips and pastes word, without manually entering edlin and replacement, reduces human cost, improves the efficiency of text-processing.
With further reference to Fig. 4, it illustrates the flow 400 of another embodiment of character string replacement method.The character string The flow 400 of replacement method, comprises the following steps:
Step 401, in response to detecting point operation of the user to target text, extract in target text pointed by user Position preset range in character string, the character string extracted is defined as character string to be replaced, and extract and prestore Character string is cliped and pasted in clipbook.
In the present embodiment, electronic equipment (such as terminal device shown in Fig. 1 of character string replacement method operation thereon 101st, 102,103) can be provided with that the user that can be stored with clipbook, above-mentioned clipbook replicates in advance clips and pastes character string. Above-mentioned electronic equipment can also show text, after user chooses some region or paragraph in shown text, above-mentioned electricity The region or paragraph that son can be chosen above-mentioned user are defined as target text.In response to detecting user to above-mentioned target text This point operation, above-mentioned electronic equipment can extract the preset range of the position pointed by above-mentioned user in above-mentioned target text Interior character string, character string to be replaced is defined as by the character string extracted, and extraction is pre-stored within cliping and pasting in clipbook Character string.
Step 402, carrying out participle to cliping and pasting character string to generate clips and pastes set of words, and treats substitute character string and carry out participle To generate set of words to be replaced.
In the present embodiment, above-mentioned electronic equipment can carry out participle using various participle modes to above-mentioned character string of cliping and pasting Set of words is cliped and pasted to generate, and above-mentioned character string to be replaced is carried out participle to generate set of words to be replaced.For example, above-mentioned electronics Equipment can carry out the above-mentioned participle for cliping and pasting character string and above-mentioned character string to be replaced using hidden Markov model.
Step 403, it is determined that clip and paste in set of words each clip and paste in the term vector and set of words to be replaced of word each treat The term vector of substitute.
In the present embodiment, above-mentioned electronic equipment can determine it is above-mentioned clip and paste in set of words each clip and paste the term vector of word With the term vector of each word to be replaced in above-mentioned set of words to be replaced.In practice, term vector can be intended to indicate that word is special The vector levied, every one-dimensional value of term vector, which represents one, has certain semanteme and the feature grammatically explained.Herein, it is above-mentioned Electronic equipment can utilize the term vector calculating instrument (such as word2vec) increased income to determine each word to be replaced using various Term vector.
Step 404, for clip and paste each in set of words clip and paste word, this is cliped and pasted the term vector of word as target word to Amount, determines the similarity of target term vector and the term vector of each word to be replaced, in response to determining to exist in set of words to be replaced The similarity of term vector and target term vector is more than the word to be replaced of default similarity threshold, and this is cliped and pasted into word and is defined as specifying Clip and paste word, and identified word to be replaced is defined as to clip and paste the specified word to be replaced that word matches with specifying;
In the present embodiment, word is cliped and pasted for each above-mentioned cliped and pasted in set of words, above-mentioned electronic equipment will can be somebody's turn to do The term vector of word is cliped and pasted as target term vector, various similarity calculating methods (such as similarity based on Euclidean distance is utilized Computational methods, cosine similarity computational methods etc.) or term vector calculating instrument (such as word2vec) determination for increasing income on The similarity of target term vector and the term vector of each word to be replaced is stated, in response to determining there is word in above-mentioned set of words to be replaced The vectorial similarity with above-mentioned target term vector is more than the word to be replaced of default similarity threshold, and this can be cliped and pasted to word determination Word is cliped and pasted to specify, and identified word to be replaced is defined as to clip and paste the specified word to be replaced that word matches with above-mentioned specify, And perform the operation of step 405 or step 406.It should be noted that above-mentioned term vector generation method and term vector it is similar Degree computational methods are widely studied at present and application known technologies, be will not be repeated here.
Step 405, for it is identified each specify clip and paste word, based on default near synonym group, determine this specify cut Whether each other patch word and being specified with this clips and pastes specified word to be replaced that word matches near synonym, if so, specified word will be cliped and pasted with this The specified word to be replaced matched is defined as target word to be replaced, and this is specified to clip and paste word and be defined as target clips and pastes word.
In the present embodiment, for it is identified each specify clip and paste word, above-mentioned electronic equipment can be based on default Whether each other near synonym group, determine that this specifies to clip and paste word and specify with this and clip and paste specified word to be replaced that word matches near synonym, It is defined as target word to be replaced if so, can will be specified with this and clip and paste the specified word to be replaced that word matches, and this specified is cut Patch word is defined as target and clips and pastes word.In practice, for it is identified each specify clip and paste word, if this specify clip and paste word and with this Specify and clip and paste the specified word to be replaced that word matches and belong to same near synonym group, then above-mentioned electronic equipment can determine that this is specified Clip and paste word and specified with this and clip and paste specified word to be replaced that word matches near synonym each other.
Step 406, for it is identified each specify clip and paste word, based on default similar phrase, determine this specify cut Patch word and specified with this and clip and paste whether the specified word to be replaced that word matches belongs to same type, if so, specified will be cliped and pasted with this The specified word to be replaced that word matches is defined as target word to be replaced, and this is specified to clip and paste word and be defined as target clips and pastes word.
In the present embodiment, for it is identified each specify clip and paste word, above-mentioned electronic equipment can be based on default Similar phrase, determines that this specifies to clip and paste word and specify with this and clips and pastes whether the specified word to be replaced that word matches belongs to same class Type, target word to be replaced is defined as if so, will be specified with this and clip and paste the specified word to be replaced that word matches, and this specified is cliped and pasted Word is defined as target and clips and pastes word.In practice, for it is identified each specify clip and paste word, if this specify clip and paste word and refer to this Surely clip and paste the specified word to be replaced that word matches and belong to same similar phrase, then above-mentioned electronic equipment can determine that this is specified and cut Patch word and being specified with this clips and pastes specified word to be replaced that word matches similar word each other.
It should be noted that for it is identified each specify clip and paste word, in response to determine this specify clip and paste word and with This, which is specified, clips and pastes the specified word to be replaced that word matches and is not belonging to same near synonym group and is not belonging to same similar phrase, on State to generate to be specified to clip and paste word and specify with this by this in electronic equipment and clip and paste what the specified word to be replaced that word matches was constituted Near synonym group, and by it is in above-mentioned character string to be replaced, specify with this and to clip and paste the specified word to be replaced that word matches and replace with this Specify and clip and paste word.
Step 407, the target word to be replaced in character string to be replaced is replaced with into target and clips and pastes word.
In the present embodiment, above-mentioned electronic equipment can replace with the target word to be replaced in above-mentioned character string to be replaced Corresponding target clips and pastes word.
Figure 4, it is seen that compared with the corresponding embodiments of Fig. 2, the stream of the character string replacement method in the present embodiment Journey 400 highlights the analyzing step to cliping and pasting set of words and set of words to be replaced.Thus, the scheme of the present embodiment description can be more Plus be accurately determined the target cliped and pasted in set of words and clip and paste target word to be replaced in word and set of words to be replaced, it is also based on Analysis result increases near synonym group, while human cost is reduced, further increases the efficiency of text-processing.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides a kind of replacement of character string One embodiment of device, the device embodiment is corresponding with the embodiment of the method shown in Fig. 2, and the device specifically can apply to In various electronic equipments.
As shown in figure 5, the character string alternative 500 described in the present embodiment includes:Extraction unit 501, is configured to ring Ying Yu detects point operation of the user to target text, extracts the pre- of position in above-mentioned target text pointed by above-mentioned user If the character string in scope, the character string extracted is defined as character string to be replaced, and extraction is pre-stored within clipbook Clip and paste character string;Participle unit 502, is configured to clip and paste set of words to above-mentioned character string progress participle of cliping and pasting to generate, and Above-mentioned character string to be replaced is carried out participle to generate set of words to be replaced;Resolution unit 503, is configured to clip and paste word to above-mentioned Set and above-mentioned set of words to be replaced are parsed, and determine that the above-mentioned target cliped and pasted in set of words clips and pastes word and above-mentioned word to be replaced In set and above-mentioned target clips and pastes the target word to be replaced that word matches;First replacement unit 504, being configured to will be above-mentioned Above-mentioned target word to be replaced in character string to be replaced replaces with above-mentioned target and clips and pastes word.
In the present embodiment, above-mentioned character string alternative 500 can be provided with clipbook, above-mentioned clipbook and can deposit Contain that user replicates in advance clips and pastes character string.Character string alternative 500 can also show text, when user choose it is shown Text in some region or paragraph after, the region or paragraph that can be chosen above-mentioned user are defined as target text.Ring Ying Yu detects point operation of the user to above-mentioned target text, and the extraction unit 501 of above-mentioned character string alternative 500 can be with The character string in the preset range of the position in above-mentioned target text pointed by above-mentioned user is extracted, the character string extracted is true It is set to character string to be replaced, and extraction is pre-stored within clipbook and clips and pastes character string.
In the present embodiment, above-mentioned participle unit 502 can be carried out using various participle modes to above-mentioned character string of cliping and pasting Participle clips and pastes set of words to generate, and above-mentioned character string to be replaced is carried out participle to generate set of words to be replaced.
In the present embodiment, above-mentioned resolution unit 503 can clip and paste set of words and upper using various analysis methods to above-mentioned State set of words to be replaced to be parsed, determine that the above-mentioned target cliped and pasted in set of words is cliped and pasted in word and above-mentioned set of words to be replaced , with above-mentioned target clip and paste the target word to be replaced that word matches.
In the present embodiment, above-mentioned first replacement unit 504 can be to be replaced by the target in above-mentioned character string to be replaced Word replaces with corresponding target and clips and pastes word.
In some optional implementations of the present embodiment, above-mentioned resolution unit 503 can include the first extraction module With the first determining module (not shown).Wherein, above-mentioned first extraction module may be configured to extract default multiple near Adopted phrase, wherein, each near synonym group in above-mentioned multiple near synonym groups includes multiple words of near synonym each other.Above-mentioned first Determining module may be configured to clip and paste word for each above-mentioned cliped and pasted in set of words, by above-mentioned multiple near synonym groups , exist and clip and paste the near synonym group of the word that word matches as target near synonym group with this, seriatim by above-mentioned word set to be replaced Each word to be replaced in conjunction is matched with the above-mentioned target near synonym group, word in addition to this clips and pastes word, in response to true There is the word to be replaced that the match is successful in fixed above-mentioned set of words to be replaced, the identified word to be replaced that the match is successful is defined as The target word to be replaced that word matches is cliped and pasted with this, and this is cliped and pasted into word is defined as target and clip and paste word.
In some optional implementations of the present embodiment, above-mentioned resolution unit 503 can include the second extraction module With the second determining module (not shown).Wherein, above-mentioned second extraction module may be configured to extract default multiple same Class phrase, wherein, each similar phrase in above-mentioned multiple similar phrases includes belonging to same type of multiple words.Above-mentioned Two determining modules may be configured to clip and paste word for each above-mentioned cliped and pasted in set of words, by above-mentioned multiple similar phrases , exist and clip and paste the similar phrase of the word that word matches as the similar phrase of target with this, seriatim by above-mentioned word set to be replaced In each word to be replaced phrase similar with above-mentioned target in the conjunction, word in addition to this clips and pastes word is matched, in response to true There is the word to be replaced that the match is successful in fixed above-mentioned set of words to be replaced, the identified word to be replaced that the match is successful is defined as The target word to be replaced that word matches is cliped and pasted with this, and this is cliped and pasted into word is defined as target and clip and paste word.
In some optional implementations of the present embodiment, above-mentioned resolution unit 503 can include the 3rd determining module, 4th determining module and the 5th determining module (not shown).Wherein, above-mentioned 3rd determining module may be configured to determine It is above-mentioned clip and paste in set of words each clip and paste the term vector of word and the word of each word to be replaced in above-mentioned set of words to be replaced to Amount.Above-mentioned 4th determining module be may be configured to clip and paste word for each above-mentioned cliped and pasted in set of words, and this is cliped and pasted into word Term vector as target term vector, determine the similarity of above-mentioned target term vector and the term vector of each word to be replaced, response In it is determined that the similarity that there is term vector and above-mentioned target term vector in above-mentioned set of words to be replaced is more than default similarity threshold The word to be replaced of value, clips and pastes word by this and is defined as specifying and clip and paste word, and identified word to be replaced is defined as to specify with above-mentioned Clip and paste the specified word to be replaced that word matches.Above-mentioned 5th determining module may be configured to for it is identified each specify Word is cliped and pasted, based on default near synonym group, determines that this is specified and clips and pastes word and specify clip and paste that word matches specified to be replaced with this Whether each other word near synonym, target word to be replaced is defined as if so, will be specified with this and clip and paste the specified word to be replaced that word matches, And specify to clip and paste word and be defined as target by this and clip and paste word.
In some optional implementations of the present embodiment, above-mentioned resolution unit 503 can also include the 6th and determine mould Block (not shown).Wherein, above-mentioned 6th determining module may be configured to for it is identified each specify clip and paste word, Based on default similar phrase, determine that this specifies to clip and paste word and specify with this and clip and paste whether the specified word to be replaced that word matches belongs to In same type, target word to be replaced is defined as if so, will be specified with this and clip and paste the specified word to be replaced that word matches, and should Specify to clip and paste word and be defined as target and clip and paste word.
In some optional implementations of the present embodiment, above-mentioned character string alternative 500 can also include second Replacement unit (not shown).Wherein, above-mentioned second replacement unit may be configured to for it is identified each specify Clip and paste word, in response to determine this specify clip and paste word and specified with this clip and paste the specified word to be replaced that word matches be not belonging to it is same Near synonym group and same similar phrase is not belonging to, generates to be specified by this and clip and paste word and specify that clips and pastes that word matches to specify with this The near synonym group that word to be replaced is constituted, and by it is in above-mentioned character string to be replaced, with this it is specified clip and paste that word matches specified treat Substitute replace with this specify clip and paste word.
The device that above-described embodiment of the application is provided, by extraction unit 501 in response to detecting user to target text This character string for performing operation, extracting in the preset range of the position in above-mentioned target text pointed by above-mentioned user, and will The character string extracted is defined as character string to be replaced, and what then 502 pairs of participle unit was extracted is pre-stored within clipbook Clip and paste character string and character string to be replaced carry out participle, clip and paste set of words and set of words to be replaced to generate respectively, then 503 pairs of resolution unit clips and pastes set of words and set of words to be replaced is parsed, and determines that target clips and pastes word and target word to be replaced, most The target word to be replaced in character string to be replaced is replaced with target and clips and pastes word by the first replacement unit 504 afterwards, without people Work enters edlin and replacement, reduces human cost, improves the efficiency of text-processing.
Below with reference to Fig. 6, it illustrates suitable for for the computer system 600 for the terminal device for realizing the embodiment of the present application Structural representation.Terminal device shown in Fig. 6 is only an example, to the function of the embodiment of the present application and should not use model Shroud carrys out any limitation.
As shown in fig. 6, computer system 600 includes CPU (CPU) 601, it can be read-only according to being stored in Program in memory (ROM) 602 or be loaded into program in random access storage device (RAM) 603 from storage part 608 and Perform various appropriate actions and processing.In RAM 603, the system that is also stored with 600 operates required various programs and data. CPU 601, ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to always Line 604.
I/O interfaces 605 are connected to lower component:Importation 606 including touch-screen, touch pad etc.;Including such as cloudy The output par, c 607 of extreme ray pipe (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage part including hard disk etc. 608;And the communications portion 609 of the NIC including LAN card, modem etc..Communications portion 609 is via all Network such as internet performs communication process.Driver 610 is also according to needing to be connected to I/O interfaces 605.Detachable media 611, Such as disk, CD, magneto-optic disk, semiconductor memory etc., are arranged on driver 610, in order to from it as needed The computer program of reading is mounted into storage part 608 as needed.
Especially, in accordance with an embodiment of the present disclosure, the process described above with reference to flow chart may be implemented as computer Software program.For example, embodiment of the disclosure includes a kind of computer program product, it includes being carried on computer-readable medium On computer program, the computer program include be used for execution flow chart shown in method program code.In such reality Apply in example, the computer program can be downloaded and installed by communications portion 609 from network, and/or from detachable media 611 are mounted.When the computer program is performed by CPU (CPU) 601, perform what is limited in the present processes Above-mentioned functions.It should be noted that computer-readable medium described herein can be computer-readable signal media or Computer-readable recording medium either the two any combination.Computer-readable recording medium for example can be --- but Be not limited to --- electricity, magnetic, optical, electromagnetic, system, device or the device of infrared ray or semiconductor, or it is any more than combination. The more specifically example of computer-readable recording medium can include but is not limited to:Electrical connection with one or more wires, Portable computer diskette, hard disk, random access storage device (RAM), read-only storage (ROM), erasable type may be programmed read-only deposit Reservoir (EPROM or flash memory), optical fiber, portable compact disc read-only storage (CD-ROM), light storage device, magnetic memory Part or above-mentioned any appropriate combination.In this application, computer-readable recording medium can any be included or store The tangible medium of program, the program can be commanded execution system, device or device and use or in connection.And In the application, computer-readable signal media can include believing in a base band or as the data of carrier wave part propagation Number, wherein carrying computer-readable program code.The data-signal of this propagation can take various forms, including but not It is limited to electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be computer Any computer-readable medium beyond readable storage medium storing program for executing, the computer-readable medium can send, propagate or transmit use In by the use of instruction execution system, device or device or program in connection.Included on computer-readable medium Program code any appropriate medium can be used to transmit, include but is not limited to:Wirelessly, electric wire, optical cable, RF etc., Huo Zheshang Any appropriate combination stated.
Flow chart and block diagram in accompanying drawing, it is illustrated that according to the system of the various embodiments of the application, method and computer journey Architectural framework in the cards, function and the operation of sequence product.At this point, each square frame in flow chart or block diagram can generation The part of one module of table, program segment or code, the part of the module, program segment or code is used comprising one or more In the executable instruction for realizing defined logic function.It should also be noted that in some realizations as replacement, being marked in square frame The function of note can also be with different from the order marked in accompanying drawing generation.For example, two square frames succeedingly represented are actually It can perform substantially in parallel, they can also be performed in the opposite order sometimes, this is depending on involved function.Also to note Meaning, the combination of each square frame in block diagram and/or flow chart and the square frame in block diagram and/or flow chart can be with holding The special hardware based system of function or operation as defined in row is realized, or can use specialized hardware and computer instruction Combination realize.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard The mode of part is realized.Described unit can also be set within a processor, for example, can be described as:A kind of processor bag Include extraction unit, participle unit, resolution unit and the first replacement unit.Wherein, the title of these units is under certain conditions simultaneously The restriction in itself to the unit is not constituted, for example, extraction unit is also described as, " character string and word to be replaced are cliped and pasted in extraction Accord with the unit of string ".
As on the other hand, present invention also provides a kind of computer-readable medium, the computer-readable medium can be Included in device described in above-described embodiment;Can also be individualism, and without be incorporated the device in.Above-mentioned calculating Machine computer-readable recording medium carries one or more program, when said one or multiple programs are performed by the device so that should Device:In response to detecting point operation of the user to target text, the position pointed by the user in the target text is extracted Preset range in character string, the character string extracted is defined as character string to be replaced, and extract to be pre-stored within and clip and paste Character string is cliped and pasted in plate;Character string progress participle is cliped and pasted to this and clips and pastes set of words to generate, and the character string to be replaced is entered Row participle is to generate set of words to be replaced;Set of words is cliped and pasted to this and the set of words to be replaced is parsed, it is determined that this clips and pastes word Target in set clips and pastes in the word and the set of words to be replaced and target and clips and pastes the target word to be replaced that word matches;Will Target word to be replaced in the character string to be replaced replaces with the target and clips and pastes word.The embodiment reduces human cost, Improve the efficiency of text-processing.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.People in the art Member should be appreciated that invention scope involved in the application, however it is not limited to the technology of the particular combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, is carried out by above-mentioned technical characteristic or its equivalent feature Other technical schemes formed by any combination.Such as features described above has similar work(with (but not limited to) disclosed herein The technical characteristic of energy carries out technical scheme formed by replacement mutually.

Claims (14)

1. a kind of character string replacement method, it is characterised in that methods described includes:
In response to detecting point operation of the user to target text, extract in pointed by user described in the target text Position preset range in character string, the character string extracted is defined as character string to be replaced, and extract and prestore Character string is cliped and pasted in clipbook;
Set of words is cliped and pasted to generate to the character string progress participle of cliping and pasting, and participle is carried out with life to the character string to be replaced Into set of words to be replaced;
Set of words is cliped and pasted to described and the set of words to be replaced is parsed, it is determined that the target cliped and pasted in set of words is cliped and pasted In the word and the set of words to be replaced and target clips and pastes the target word to be replaced that word matches;
Target word to be replaced in the character string to be replaced is replaced with into the target and clips and pastes word.
2. character string replacement method according to claim 1, it is characterised in that described to clip and paste set of words and described to described Set of words to be replaced is parsed, it is determined that the target cliped and pasted in set of words clip and paste it is in word and the set of words to be replaced, The target word to be replaced that word matches is cliped and pasted with the target, including:
Default multiple near synonym groups are extracted, wherein, each near synonym group in the multiple near synonym group includes near each other Multiple words of adopted word;
Clip and paste word for each cliped and pasted in set of words, by it is in the multiple near synonym group, exist and clip and paste word with this The near synonym group of the word matched is as target near synonym group, seriatim by each word to be replaced in the set of words to be replaced Matched with the target near synonym group, word in addition to this clips and pastes word, in response to determining the set of words to be replaced It is middle to there is the word to be replaced that the match is successful, the identified word to be replaced that the match is successful is defined as cliping and pasting what word matched with this Target word to be replaced, and this is cliped and pasted into word be defined as target and clip and paste word.
3. character string replacement method according to claim 1, it is characterised in that described to clip and paste set of words and described to described Set of words to be replaced is parsed, it is determined that the target cliped and pasted in set of words clip and paste it is in word and the set of words to be replaced, The target word to be replaced that word matches is cliped and pasted with the target, including:
Default multiple similar phrases are extracted, wherein, each similar phrase in the multiple similar phrase includes belonging to same Multiple words of one type;
Clip and paste word for each cliped and pasted in set of words, by it is in the multiple similar phrase, exist and clip and paste word with this The similar phrase of the word matched is as the similar phrase of target, seriatim by each word to be replaced in the set of words to be replaced In phrase similar with the target, word in addition to this clips and pastes word is matched, in response to determining the set of words to be replaced It is middle to there is the word to be replaced that the match is successful, the identified word to be replaced that the match is successful is defined as cliping and pasting what word matched with this Target word to be replaced, and this is cliped and pasted into word be defined as target and clip and paste word.
4. character string replacement method according to claim 1, it is characterised in that described to clip and paste set of words and described to described Set of words to be replaced is parsed, it is determined that the target cliped and pasted in set of words clip and paste it is in word and the set of words to be replaced, The target word to be replaced that word matches is cliped and pasted with the target, including:
It is determined that it is described clip and paste in set of words each clip and paste in the term vector and the set of words to be replaced of word each is to be replaced The term vector of word;
Word is cliped and pasted for each cliped and pasted in set of words, this is cliped and pasted to the term vector of word as target term vector, it is determined that The similarity of the target term vector and the term vector of each word to be replaced, in response to determining to exist in the set of words to be replaced The similarity of term vector and the target term vector is more than the word to be replaced of default similarity threshold, and this is cliped and pasted into word and is defined as Specify and clip and paste word, and identified word to be replaced is defined as to clip and paste the specified word to be replaced that word matches with described specify;
For it is identified each specify clip and paste word, based on default near synonym group, determine this specify clip and paste word and refer to this Surely specified word to be replaced that word matches whether each other near synonym are cliped and pasted, if so, will specify that clips and pastes that word matches to specify with this Word to be replaced is defined as target word to be replaced, and this is specified to clip and paste word and be defined as target clips and pastes word.
5. character string replacement method according to claim 4, it is characterised in that this is cliped and pasted into word be defined as specifying described Clip and paste word, and by identified word to be replaced be defined as with it is described specify clip and paste the specified word to be replaced that word matches after, institute State and clip and paste set of words and the set of words to be replaced is parsed to described, it is determined that the target cliped and pasted in set of words clips and pastes word The target word to be replaced that word matches is cliped and pasted with the set of words to be replaced and target, in addition to:
For it is identified each specify clip and paste word, based on default similar phrase, determine this specify clip and paste word and refer to this Surely clip and paste whether the specified word to be replaced that word matches belongs to same type, if so, cliping and pasting the finger that word matches by being specified with this Fixed word to be replaced is defined as target word to be replaced, and this is specified to clip and paste word and be defined as target clips and pastes word.
6. character string replacement method according to claim 5, it is characterised in that methods described, in addition to:
For it is identified each specify and clip and paste word, clip and paste word in response to determining that this specifies to clip and paste word and specify with this and match Specified word to be replaced be not belonging to same near synonym group and be not belonging to same similar phrase, generation by this specify clip and paste word and Specified with this and clip and paste the near synonym group that the specified word to be replaced that word matches is constituted, and by the character string to be replaced and This, which specifies to clip and paste the specified word to be replaced that word matches and replace with this, specified clips and pastes word.
7. a kind of character string alternative, it is characterised in that described device includes:
Extraction unit, is configured to the point operation in response to detecting user to target text, extracts in target text Character string in the preset range of position described in this pointed by user, character to be replaced is defined as by the character string extracted Go here and there, and extraction is pre-stored within clipbook and clips and pastes character string;
Participle unit, is configured to clip and paste set of words to the character string progress participle of cliping and pasting to generate, and to described to be replaced Character string carries out participle to generate set of words to be replaced;
Resolution unit, is configured to clip and paste set of words and the set of words to be replaced is parsed to described, it is determined that described clip and paste Target in set of words clips and pastes that in word and the set of words to be replaced, that the target that word matches is cliped and pasted with the target is to be replaced Word;
First replacement unit, is configured to the target word to be replaced in the character string to be replaced replacing with the target Clip and paste word.
8. character string alternative according to claim 7, it is characterised in that the resolution unit includes:
First extraction module, is configured to extract default multiple near synonym groups, wherein, it is each in the multiple near synonym group Individual near synonym group includes multiple words of near synonym each other;
First determining module, is configured to clip and paste word for each cliped and pasted in set of words, by the multiple near synonym It is in group, exist and clip and paste the near synonym group of the word that word matches as target near synonym group with this, seriatim will be described to be replaced Each word to be replaced in set of words is matched with the target near synonym group, word in addition to this clips and pastes word, response It is in it is determined that there is the word to be replaced that the match is successful in the set of words to be replaced, the identified word to be replaced that the match is successful is true It is set to and clips and pastes the target word to be replaced that word matches with this, and this is cliped and pasted into word is defined as target and clip and paste word.
9. character string alternative according to claim 7, it is characterised in that the resolution unit includes:
Second extraction module, is configured to extract default multiple similar phrases, wherein, it is each in the multiple similar phrase Individual similar phrase includes belonging to same type of multiple words;
Second determining module, is configured to clip and paste word for each cliped and pasted in set of words, by the multiple similar word It is in group, exist and clip and paste the similar phrase of the word that word matches as the similar phrase of target with this, seriatim will be described to be replaced In each word to be replaced phrase similar with the target in the set of words, word in addition to this clips and pastes word is matched, response It is in it is determined that there is the word to be replaced that the match is successful in the set of words to be replaced, the identified word to be replaced that the match is successful is true It is set to and clips and pastes the target word to be replaced that word matches with this, and this is cliped and pasted into word is defined as target and clip and paste word.
10. character string alternative according to claim 7, it is characterised in that the resolution unit includes:
3rd determining module, each for being configured to clip and paste in set of words described in determining clips and pastes the term vector of word and described to be replaced The term vector of each word to be replaced in set of words;
4th determining module, is configured to clip and paste word for each cliped and pasted in set of words, by this clip and paste the word of word to Amount determines the similarity of the target term vector and the term vector of each word to be replaced as target term vector, in response to determining The similarity that there is term vector and the target term vector in the set of words to be replaced is more than treating for default similarity threshold Substitute, clips and pastes word by this and is defined as specifying and clip and paste word, and identified word to be replaced is defined as to clip and paste word with described specify The specified word to be replaced matched;
5th determining module, be configured to for it is identified each specify clip and paste word, based on default near synonym group, it is determined that Whether each other this specifies to clip and paste word and specify with this clips and pastes specified word to be replaced that word matches near synonym, if so, will refer to this Surely clip and paste the specified word to be replaced that word matches and be defined as target word to be replaced, and this is specified to clip and paste word and be defined as target clip and paste Word.
11. character string alternative according to claim 10, it is characterised in that the resolution unit also includes:
6th determining module, be configured to for it is identified each specify clip and paste word, based on default similar phrase, it is determined that This, which specifies to clip and paste word and specify with this, clips and pastes whether the specified word to be replaced that word matches belongs to same type, if so, will be with this Specify and clip and paste the specified word to be replaced that word matches and be defined as target word to be replaced, and by this it is specified clip and paste word and be defined as target cut Paste word.
12. character string alternative according to claim 11, it is characterised in that described device also includes:
Second replacement unit, be configured to for it is identified each specify clip and paste word, in response to determine this specify clip and paste word Clip and paste the specified word to be replaced that word matches with being specified with this and be not belonging to same near synonym group and be not belonging to same similar word Group, generates to be specified to clip and paste word and specify with this by this and clips and pastes the near synonym group that the specified word to be replaced that word matches is constituted, and general It is in the character string to be replaced, specify to clip and paste the specified word to be replaced that word matches and replace with this with this and specified clip and paste word.
13. a kind of terminal device, including:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are by one or more of computing devices so that one or more of processors are real The existing method as described in any in claim 1-6.
14. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that the program is by processor The method as described in any in claim 1-6 is realized during execution.
CN201710351638.3A 2017-05-18 2017-05-18 Character string replacing method and device Active CN107203504B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710351638.3A CN107203504B (en) 2017-05-18 2017-05-18 Character string replacing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710351638.3A CN107203504B (en) 2017-05-18 2017-05-18 Character string replacing method and device

Publications (2)

Publication Number Publication Date
CN107203504A true CN107203504A (en) 2017-09-26
CN107203504B CN107203504B (en) 2021-02-26

Family

ID=59906530

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710351638.3A Active CN107203504B (en) 2017-05-18 2017-05-18 Character string replacing method and device

Country Status (1)

Country Link
CN (1) CN107203504B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062879A (en) * 2018-07-04 2018-12-21 珠海市魅族科技有限公司 A kind of replacement method and device
CN110162794A (en) * 2019-05-29 2019-08-23 腾讯科技(深圳)有限公司 A kind of method and server of participle
CN110929522A (en) * 2019-08-19 2020-03-27 网娱互动科技(北京)股份有限公司 Intelligent synonym replacement method and system
CN111159978A (en) * 2019-12-30 2020-05-15 北京爱医生智慧医疗科技有限公司 Method and device for replacing character strings
CN111611788A (en) * 2020-04-14 2020-09-01 大唐软件技术股份有限公司 Data processing method and device, electronic equipment and storage medium
CN111783858A (en) * 2020-06-19 2020-10-16 厦门市美亚柏科信息股份有限公司 Method and device for generating category vector
CN113688359A (en) * 2020-05-18 2021-11-23 北京京东尚科信息技术有限公司 Processing method and device for program code, computing equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7818458B2 (en) * 2007-12-03 2010-10-19 Microsoft Corporation Clipboard for application sharing
CN102141933A (en) * 2011-01-17 2011-08-03 博视联(苏州)信息科技有限公司 System for providing multiple multiplexing and pasting of computer application program and method thereof
CN103617154A (en) * 2013-11-29 2014-03-05 百度在线网络技术(北京)有限公司 Method and device for having control over content paste operation
CN105095222A (en) * 2014-04-25 2015-11-25 阿里巴巴集团控股有限公司 Unit word replacing method, search method and replacing apparatus
CN105868236A (en) * 2015-12-09 2016-08-17 乐视网信息技术(北京)股份有限公司 Synonym data mining method and system
CN106649783A (en) * 2016-12-28 2017-05-10 上海智臻智能网络科技股份有限公司 Synonym mining method and apparatus

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7818458B2 (en) * 2007-12-03 2010-10-19 Microsoft Corporation Clipboard for application sharing
CN102141933A (en) * 2011-01-17 2011-08-03 博视联(苏州)信息科技有限公司 System for providing multiple multiplexing and pasting of computer application program and method thereof
CN103617154A (en) * 2013-11-29 2014-03-05 百度在线网络技术(北京)有限公司 Method and device for having control over content paste operation
CN105095222A (en) * 2014-04-25 2015-11-25 阿里巴巴集团控股有限公司 Unit word replacing method, search method and replacing apparatus
CN105868236A (en) * 2015-12-09 2016-08-17 乐视网信息技术(北京)股份有限公司 Synonym data mining method and system
CN106649783A (en) * 2016-12-28 2017-05-10 上海智臻智能网络科技股份有限公司 Synonym mining method and apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DIDIBABA: "大批量同义词替换的思路", 《HTTPS://BBS.CSDN.NET/TOPICS/330009727》 *
X-FORCE: "安卓上的剪贴板增强神器工具", 《HTTPS://WWW.IPLAYSOFT.COM/CLIPBOARD-PLUS.HTML》 *

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062879A (en) * 2018-07-04 2018-12-21 珠海市魅族科技有限公司 A kind of replacement method and device
CN110162794A (en) * 2019-05-29 2019-08-23 腾讯科技(深圳)有限公司 A kind of method and server of participle
CN110929522A (en) * 2019-08-19 2020-03-27 网娱互动科技(北京)股份有限公司 Intelligent synonym replacement method and system
CN111159978A (en) * 2019-12-30 2020-05-15 北京爱医生智慧医疗科技有限公司 Method and device for replacing character strings
CN111159978B (en) * 2019-12-30 2023-07-21 北京爱医生智慧医疗科技有限公司 Character string replacement processing method and device
CN111611788A (en) * 2020-04-14 2020-09-01 大唐软件技术股份有限公司 Data processing method and device, electronic equipment and storage medium
CN111611788B (en) * 2020-04-14 2024-02-09 大唐软件技术股份有限公司 Data processing method and device, electronic equipment and storage medium
CN113688359A (en) * 2020-05-18 2021-11-23 北京京东尚科信息技术有限公司 Processing method and device for program code, computing equipment and medium
CN111783858A (en) * 2020-06-19 2020-10-16 厦门市美亚柏科信息股份有限公司 Method and device for generating category vector
CN111783858B (en) * 2020-06-19 2022-07-15 厦门市美亚柏科信息股份有限公司 Method and device for generating category vector

Also Published As

Publication number Publication date
CN107203504B (en) 2021-02-26

Similar Documents

Publication Publication Date Title
CN107203504A (en) Character string replacement method and device
CN107273503B (en) Method and device for generating parallel text in same language
CN110162767A (en) The method and apparatus of text error correction
CN108804512A (en) Generating means, method and the computer readable storage medium of textual classification model
CN107491547A (en) Searching method and device based on artificial intelligence
CN107832305A (en) Method and apparatus for generating information
CN108171276A (en) For generating the method and apparatus of information
CN106919711A (en) The method and apparatus of the markup information based on artificial intelligence
CN107679217A (en) Association method for extracting content and device based on data mining
CN107301170A (en) The method and apparatus of cutting sentence based on artificial intelligence
CN108121699A (en) For the method and apparatus of output information
CN108197592A (en) Information acquisition method and device
CN109992766A (en) The method and apparatus for extracting target word
CN107145485A (en) Method and apparatus for compressing topic model
CN109871311A (en) A kind of method and apparatus for recommending test case
CN109299477A (en) Method and apparatus for generating text header
CN109697537A (en) The method and apparatus of data audit
CN108984554A (en) Method and apparatus for determining keyword
CN107517251A (en) Information-pushing method and device
CN111666379B (en) Event element extraction method and device
CN109002385A (en) Method for testing pressure and device for data flow system
CN109284367A (en) Method and apparatus for handling text
CN107402905A (en) Computational methods and device based on neutral net
CN109828759A (en) Code compiling method, device, computer installation and storage medium
CN108460020A (en) Method and device for obtaining information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant