[summary of the invention]
The many aspects of the application provide the recognition methods of text messy code and device in a kind of page, to improve text unrestThe efficiency and reliability of the identification of code.
The one side of the application provides a kind of recognition methods of text messy code in the page, comprising:
Obtain the first coded format of the first text to be identified in the page;
According to the corresponding relationship between character corresponding to character corresponding to the second coded format and other coded formats,It is the second text by first text conversion, the coded format of second text is second coded format;
According between character corresponding to character corresponding to second coded format and first coded formatSecond text conversion is third text by corresponding relationship;
According to the third text and first text, determine in first text with the presence or absence of messy code.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, described second compilesCode format includes Unicode coded format.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, it is described according to instituteThird text and first text are stated, is determined in first text with the presence or absence of messy code, comprising:
The third text and first text are compared;
If the third text and first text are inconsistent, determine that there are messy codes in first text;Or
If the third text is consistent with first text, determine that there is no messy codes in first text.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, it is described to describedThird text and first text are compared, comprising:
Extract the characteristic information of the third text and the characteristic information of first text;
The characteristic information of characteristic information and first text to the third text is compared;
If the characteristic information of the third text is not identical as the characteristic information of first text, illustrate the third textThis is inconsistent with first text;Or
If the characteristic information of the third text is identical as the characteristic information of first text, illustrate the third textIt is consistent with first text.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the feature letterBreath includes MD5 value.
The another aspect of the application provides a kind of identification device of text messy code in the page, comprising:
Acquiring unit, for obtaining the first coded format of the first text to be identified in the page;
Converting unit, for character corresponding to the character according to corresponding to the second coded format and other coded formats itBetween corresponding relationship, be the second text by first text conversion, the coded format of second text is described second to compileCode format;
The converting unit is also used to the character according to corresponding to second coded format and first coded formatSecond text conversion is third text by the corresponding relationship between corresponding character;
Determination unit, for determining whether deposit in first text according to the third text and first textIn messy code.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, described second compilesCode format includes Unicode coded format.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, it is described determining singleMember is specifically used for
The third text and first text are compared;
If the third text and first text are inconsistent, determine that there are messy codes in first text;Or
If the third text is consistent with first text, determine that there is no messy codes in first text.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, it is described determining singleMember is specifically used for
Extract the characteristic information of the third text and the characteristic information of first text;
The characteristic information of characteristic information and first text to the third text is compared;
If the characteristic information of the third text is not identical as the characteristic information of first text, illustrate the third textThis is inconsistent with first text;Or
If the characteristic information of the third text is identical as the characteristic information of first text, illustrate the third textIt is consistent with first text.
The aspect and any possible implementation manners as described above, it is further provided a kind of implementation, the feature letterBreath includes MD5 value.
As shown from the above technical solution, the embodiment of the present application is compiled by the first of the first text to be identified in the acquisition pageCode format, and then the corresponding pass between the character according to corresponding to the second coded format and character corresponding to other coded formatsFirst text conversion is the second text with second coded format, further according to second coded format by systemSecond text conversion is by the corresponding relationship between character corresponding to corresponding character and first coded formatThird text makes it possible to be determined in first text according to the third text and first text with the presence or absence of disorderlyCode participates in identification process without operator, easy to operate, and accuracy is high, thus improve the identification of text messy codeEfficiency and reliability.
[specific embodiment]
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present applicationIn attached drawing, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described embodiment isSome embodiments of the present application, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the artWhole other embodiments obtained without creative efforts, shall fall in the protection scope of this application.
It is understood that the page involved in the application, can be based on hypertext markup language (HyperTextMarkup Language, HTML) webpage (Web Page) write, it is referred to as Web page.
It should be noted that terminal involved in the embodiment of the present application can include but is not limited to mobile phone, individual digitalAssistant (Personal Digital Assistant, PDA), wireless handheld device, wireless networking sheet, PC, portable electricityBrain, PC (Personal Computer, PC), MP3 player, MP4 player etc..
In addition, the terms "and/or", only a kind of incidence relation for describing affiliated partner, indicates may existThree kinds of relationships, for example, A and/or B, can indicate: individualism A exists simultaneously A and B, these three situations of individualism B.SeparatelyOutside, character "/" herein typicallys represent the relationship that forward-backward correlation object is a kind of "or".
The flow diagram of the recognition methods of text messy code in the page that Fig. 1 provides for one embodiment of the application, such as Fig. 1 instituteShow.
101, the first coded format of the first text to be identified in the page is obtained.
Wherein, first coded format can be all optional text code modes in the prior art, for example, GBKCoding mode, UTF-8 coding mode or GB2312 coding mode etc., the present embodiment is to this without being particularly limited to.
GBK is one of encoding of chinese characters standard, and (GBK is " national standard ", the spelling of " extension " Chinese to full name " Chinese Internal Code Specification "The first letter of sound, can also be known as Chinese character international proliferation code, and English name is Chinese Internal CodeSpecification).
UTF is the abbreviation of " UCS Transformation Format ", can translate into Unicode character set conversion latticeFormula.
It optionally,, specifically can be according to the phase of the page in 101 in a possible implementation of the present embodimentInformation is closed, the first coded format of the first text to be identified in the page is obtained.
For example, can be " < meta http-equiv=" Content-Type " content according to the META label of the page="text/html;Charset=gb2312 " > ", the first coded format for obtaining the first text to be identified in the page areGB2312 coded format.
Alternatively, for another example can be according in Cascading Style Sheet (Cascading Style Sheet, CSS) file of the pageDefinition be "@charset " UTF-8 " ", the first coded format for obtaining the first text to be identified in the page is that UTF-8 is compiledCode format.
Alternatively, for another example first of the first text to be identified in the page according to the website belonging to the page, can be obtainedCoded format.Such as, the coding mode that Baidu uses is GB2312 coding mode, and the coding mode that Google is used is UTF-8 volumeCode mode etc..
102, corresponding between the character according to corresponding to the second coded format and character corresponding to other coded formatsRelationship, is the second text by first text conversion, and the coded format of second text is second coded format.
Optionally, in a possible implementation of the present embodiment, second coded format may include but notIt is limited to Unicode coded format.The Chinese of Unicode can be translated as Unicode, international code, Unicode or single code, it isEach character rather than the unique code of glyph definition (i.e. an integer), for example, unique binary coding.
During conversion, if some character in first text has corresponding to corresponding second coded formatCharacter, then the character can be then converted to character corresponding to corresponding second coded format;If first textSome character in this does not have character corresponding to corresponding second coded format, then can then execute former preconfigured behaviourMake, for example, abandoning the character, or one preset substitution character of supplement, the present embodiment is to this without being particularly limited to.
103, character corresponding to the character according to corresponding to second coded format and first coded format itBetween corresponding relationship, by second text conversion be third text.
During conversion, if some character in second text has corresponding to corresponding first coded formatCharacter, then the character can be then converted to character corresponding to corresponding first coded format;If second textSome character in this does not have character corresponding to corresponding first coded format, then can then execute former preconfigured behaviourMake, for example, abandoning the character, or one preset substitution character of supplement, the present embodiment is to this without being particularly limited to.
104, it according to the third text and first text, determines in first text with the presence or absence of messy code.
It optionally, in 104, specifically can be to the third text in a possible implementation of the present embodimentThis and first text are compared.If the third text and first text are inconsistent, described can be determinedThere are messy codes in one text;If the third text is consistent with first text, can determine first textIn be not present messy code.
Specifically, compare the i.e. described third text of two texts and first text, many methods can be used.
For example, can directly two texts be carried out with the matching of character, judge one by one character in two texts whether oneIt causes.
Alternatively, for another example extract the characteristic information of the third text and the characteristic information of first text, for example,Message Digest Algorithm 5 (Message Digest Algorithm, MD5) value;In turn, to the feature of the third textThe characteristic information of information and first text is compared;If the characteristic information of the third text and first textCharacteristic information is not identical, it can be said that the bright third text and first text are inconsistent;If the third textCharacteristic information it is identical as the characteristic information of first text, it can be said that the bright third text and first text oneIt causes.
It, can be with for example, Web page editing machine it should be noted that 101~104 executing subject can be identification deviceIn the client being located locally, to carry out identified off-line, or it may be located in the server of network side, to be known onlineNot, the present embodiment is to this without limiting.
It is understood that the client can be mounted in the application program in terminal, or it can also be browsingOne webpage of device, as long as the objective reality form that can be realized page processing is ok, the present embodiment is to this without limiting.
Existing recognition methods needs one by one to check Web page by operator, to find in the Web pageText whether there is mess code phenomenon.However, manually checking whether messy code is easy to bring two problems the page.
The first, efficiency is very low, the website of especially slightly larger type, and subpage frame just has hundreds of thousands, and operator can not be one by oneIt checks;
The second, manual identified is easy to miss the messy code in the page, for example, the feelings that messy code is seldom in the page, there are many textCondition, operator are difficult naked eyes and find.
Using technical solution provided in this embodiment, participated in without operator, it is easy to operate, and also accuracy is high.
In the present embodiment, by the first coded format of the first text to be identified in the acquisition page, and then according to secondCorresponding relationship between character corresponding to character corresponding to coded format and other coded formats turns first textIt is changed to the second text with second coded format, further according to character corresponding to second coded format and described theSecond text conversion is third text, makes it possible to root by the corresponding relationship between character corresponding to one coded formatAccording to the third text and first text, determines in first text with the presence or absence of messy code, participated in without operatorIdentification process, it is easy to operate, and also accuracy is high, to improve the efficiency and reliability of the identification of text messy code.
In addition, can be carried out automatically to the messy code that the text in the page occurs using technical solution provided by the present applicationIdentification, real-time are good.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series ofCombination of actions, but those skilled in the art should understand that, the application is not limited by the described action sequence becauseAccording to the application, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also knowIt knows, the embodiments described in the specification are all preferred embodiments, related actions and modules not necessarily the applicationIt is necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodimentPoint, reference can be made to the related descriptions of other embodiments.
The structural schematic diagram of the identification device of text messy code, such as Fig. 2 in the page that Fig. 2 provides for another embodiment of the applicationIt is shown.The identification device of text messy code may include acquiring unit 21, converting unit 22 and determine single in the page of the present embodimentMember 23.Wherein, acquiring unit 21, for obtaining the first coded format of the first text to be identified in the page;Converting unit 22,For the corresponding relationship between character corresponding to the character according to corresponding to the second coded format and other coded formats, by instituteStating the first text conversion is the second text, and the coded format of second text is second coded format;The conversion is singleMember 22, is also used between character corresponding to the character according to corresponding to second coded format and first coded formatCorresponding relationship, by second text conversion be third text;Determination unit 23, for according to the third text and describedFirst text determines in first text with the presence or absence of messy code.
Wherein, first coded format can be all optional text code modes in the prior art, for example, GBKCoding mode, UTF-8 coding mode or GB2312 coding mode etc., the present embodiment is to this without being particularly limited to.
GBK is one of encoding of chinese characters standard, and (GBK is " national standard ", the spelling of " extension " Chinese to full name " Chinese Internal Code Specification "The first letter of sound, can also be known as Chinese character international proliferation code, and English name is Chinese Internal CodeSpecification).
UTF is the abbreviation of " UCS Transformation Format ", can translate into Unicode character set conversion latticeFormula.
Optionally, in a possible implementation of the present embodiment, the acquiring unit 21 specifically can be according to pageThe relevant information in face obtains the first coded format of the first text to be identified in the page.
For example, the acquiring unit 21 can be " < meta http-equiv=" according to the META label of the pageContent-Type"content="text/html;Charset=gb2312 " > " obtains the first text to be identified in the pageThis first coded format is GB2312 coded format.
Alternatively, for another example the acquiring unit 21 can be according to Cascading Style Sheet (the Cascading Style of the pageSheet, CSS) definition in file is "@charset " UTF-8 " ", obtain first of the first text to be identified in the pageCoded format is UTF-8 coded format.
Alternatively, for another example the acquiring unit 21 can obtain to be identified in the page according to the website belonging to the pageFirst coded format of the first text.Such as, the coding mode that Baidu uses is GB2312 coding mode, the coding that Google is usedMode is UTF-8 coding mode etc..
Optionally, in a possible implementation of the present embodiment, second coded format may include but notIt is limited to Unicode coded format.The Chinese of Unicode can be translated as Unicode, international code, Unicode or single code, it isEach character rather than the unique code of glyph definition (i.e. an integer), for example, unique binary coding.
Specifically, the converting unit 22 is during executing conversion for the first time, if certain in first textA character has character corresponding to corresponding second coded format, then the character can be then converted to corresponding second codingCharacter corresponding to format;If some character in first text does not have word corresponding to corresponding second coded formatSymbol, then former preconfigured operation can be then executed, for example, the character is abandoned, or one preset substitution character of supplement, thisEmbodiment is to this without being particularly limited to.
Specifically, the converting unit 22 is during executing second of conversion, if certain in second textA character has character corresponding to corresponding first coded format, then the character can be then converted to corresponding first codingCharacter corresponding to format;If some character in second text does not have word corresponding to corresponding first coded formatSymbol, then then can be with the preconfigured operation of executor, for example, abandoning the character, or one preset substitution character of supplement, originallyEmbodiment is to this without being particularly limited to.
Optionally, in a possible implementation of the present embodiment, the determination unit 23 specifically can be used for pairThe third text and first text are compared;It, can be with if the third text and first text are inconsistentDetermine that there are messy codes in first text;If the third text is consistent with first text, can determine instituteIt states and messy code is not present in the first text.
Specifically, the determination unit 23 compares the i.e. described third text of two texts and first text, can adoptWith many methods.
For example, the determination unit 23 can directly carry out the matching of character to two texts, two texts are judged one by oneIn character it is whether consistent.
Alternatively, for another example the determination unit 23 extracts the characteristic information and first text of the third textCharacteristic information, for example, Message Digest Algorithm 5 (Message Digest Algorithm, MD5) value;In turn, to describedThe characteristic information of the characteristic information of third text and first text is compared;If the characteristic information of the third text withThe characteristic information of first text is not identical, it can be said that the bright third text and first text are inconsistent;OrIf the characteristic information of the third text is identical as the characteristic information of first text, it can be said that the bright third text withFirst text is consistent.
It should be noted that in the page provided in this embodiment text messy code identification device, for example, Web page editorDevice in the client that can be located locally, to carry out identified off-line, or may be located in the server of network side, with intoRow online recognition, the present embodiment is to this without limiting.
It is understood that the client can be mounted in the application program in terminal, or it can also be browsingOne webpage of device, as long as the objective reality form that can be realized page processing is ok, the present embodiment is to this without limiting.
Existing identification device needs one by one to check Web page by operator, to find in the Web pageText whether there is mess code phenomenon.However, manually checking whether messy code is easy to bring two problems the page.
The first, efficiency is very low, the website of especially slightly larger type, and subpage frame just has hundreds of thousands, and operator can not be one by oneIt checks;
The second, manual identified is easy to miss the messy code in the page, for example, the feelings that messy code is seldom in the page, there are many textCondition, operator are difficult naked eyes and find.
Using technical solution provided in this embodiment, participated in without operator, it is easy to operate, and also accuracy is high.
In the present embodiment, by the first coded format of the first text to be identified in the acquiring unit acquisition page, in turnAs converting unit character according to corresponding to the second coded format pass corresponding between character corresponding to other coded formatsFirst text conversion is the second text with second coded format, further according to second coded format by systemSecond text conversion is by the corresponding relationship between character corresponding to corresponding character and first coded formatThird text enables determination unit according to the third text and first text, and determining in first text isNo there are messy codes, participate in identification process without operator, easy to operate, and accuracy is high, to improve text messy codeIdentification efficiency and reliability.
In addition, can be carried out automatically to the messy code that the text in the page occurs using technical solution provided by the present applicationIdentification, real-time are good.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be withIt realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unitIt divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or componentsIt can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown orThe mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unitIt closes or communicates to connect, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unitThe component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multipleIn network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme's.
It, can also be in addition, each functional unit in each embodiment of the application can integrate in one processing unitIt is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated listMember both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at oneIn storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computerIt is each that equipment (can be personal computer, server or the network equipment etc.) or processor (processor) execute the applicationThe part steps of embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. it is variousIt can store the medium of program code.
Finally, it should be noted that above embodiments are only to illustrate the technical solution of the application, rather than its limitations;AlthoughThe application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it still may be usedTo modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features;And these are modified or replaceed, each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution spirit andRange.