Summary of the invention
In view of above-mentioned, present disclose provides a kind of file classification method and devices.Using this method and device, by will be to
Classifying text is disassembled into the character module string being made of character module more smaller than character granularity, and convolutional neural networks are then used
To execute character module string text classification processing, due to executing at convolution in convolutional layer for the smaller character module of granularity
Thus reason improves text point so that can produce more interactive information compared to the process of convolution executed based on participle
Class accuracy rate.
According to one aspect of the disclosure, a kind of file classification method is provided, comprising: disassemble rule according to predetermined Chinese character
Treat classifying text and carry out Chinese character dismantling, to obtain character module string, each Chinese character in the text to be sorted be disassembled for
At least one character module, the character module are the small character Component units of fineness ratio chinese character;And use convolution mind
Come to carry out text classification processing to the character module string through network model.
Optionally, in an example of above-mentioned aspect, the predetermined Chinese character dismantling rule includes predetermined Chinese character pattern knot
Structure dismantling rule.
Optionally, in an example of above-mentioned aspect, the predetermined Chinese character pattern structure dismantling rule includes: Chinese character portion
Part construction rule, head and the tail decomposition rule or a combination thereof.
Optionally, in an example of above-mentioned aspect, the convolutional neural networks model includes TextCNN model.
Optionally, in an example of above-mentioned aspect, using convolutional neural networks model come to the character module string
Carrying out text classification processing may include: to carry out the input layer that the character module string is input to the convolutional neural networks model
Vectorization processing is carried out, is indicated with obtaining the vector of each character module in the character module string;It will be obtained each
The term vector of character module indicates the convolutional layer being input in the convolutional neural networks model to carry out process of convolution, to obtain
Semantic matrix corresponding to the character module string;Obtained semantic matrix is input to the pond in the neural network model
Change layer to calculate to carry out pondization, to obtain semantic vector corresponding to the character module string;And by it is obtained it is semantic to
The classification layer that is input in the convolutional neural networks model is measured to carry out classification processing, with point of the determination text to be sorted
Class result.
Optionally, in an example of above-mentioned aspect, the pondization calculating may include: using maximum value pond
(max-pooling) algorithm calculates to carry out pondization;Or Chi Huaji is carried out using mean value pond (avg-pooling) algorithm
It calculates.
According to another aspect of the present disclosure, a kind of document sorting apparatus is provided, comprising: Chinese character disassembles unit, is configured as
Classifying text is treated according to predetermined Chinese character dismantling rule and carries out Chinese character dismantling, to obtain character module string, the text to be sorted
In each Chinese character be disassembled as at least one character module, the character module is that the small character of fineness ratio chinese character is constituted
Unit;And text classification unit, it is configured with convolutional neural networks model to carry out text to the character module string
Classification processing.
Optionally, in an example of above-mentioned aspect, the predetermined Chinese character dismantling rule includes predetermined Chinese character pattern knot
Structure dismantling rule.
Optionally, in an example of above-mentioned aspect, the predetermined Chinese character pattern structure dismantling rule includes: Chinese character portion
Part construction rule, head and the tail decomposition rule or a combination thereof.
Optionally, in an example of above-mentioned aspect, the convolutional neural networks model may include: input layer, quilt
Be configured to the character module string carry out vectorization processing, with obtain each character module in the character module string to
Amount indicates;Convolutional layer is configured as indicating to execute process of convolution to the vector of obtained each character module, described to obtain
Semantic matrix corresponding to character module string;Pond layer is configured as executing obtained semantic matrix pondization calculating, with
To semantic vector corresponding to the character module string;And classification layer, it is configured as executing obtained semantic vector and divide
Class processing, with the classification results of the determination text to be sorted.
According to another aspect of the present disclosure, a kind of calculating equipment is provided, comprising: one or more processors, and with institute
State the memory of one or more processors coupling, the memory store instruction, when described instruction is one or more of
When processor executes, so that one or more of processors execute file classification method as described above.
According to another aspect of the present disclosure, a kind of non-transitory machinable medium is provided, is stored with executable
Instruction, described instruction make the machine execute file classification method as described above upon being performed.
Specific embodiment
Theme described herein is discussed referring now to example embodiment.It should be understood that discussing these embodiments only
It is in order to enable those skilled in the art can better understand that being not to claim to realize theme described herein
Protection scope, applicability or the exemplary limitation illustrated in book.It can be in the protection scope for not departing from present disclosure
In the case of, the function and arrangement of the element discussed are changed.Each example can according to need, omit, substitute or
Add various processes or component.For example, described method can be executed according to described order in a different order, with
And each step can be added, omits or combine.In addition, feature described in relatively some examples is in other examples
It can be combined.
As used in this article, term " includes " and its modification indicate open term, are meant that " including but not limited to ".
Term "based" indicates " being based at least partially on ".Term " one embodiment " and " embodiment " expression " at least one implementation
Example ".Term " another embodiment " expression " at least one other embodiment ".Term " first ", " second " etc. may refer to not
Same or identical object.Here may include other definition, either specific or implicit.Unless bright in context
It really indicates, otherwise the definition of a term is consistent throughout the specification.
Fig. 1 shows the flow chart of file classification method according to an embodiment of the present disclosure.
As shown in Figure 1, treating classifying text in block 110 according to predetermined Chinese character dismantling rule and carrying out Chinese character dismantling, to obtain
Character module string.Each Chinese character in the text to be sorted is disassembled as at least one character module, wherein the Chinese character mould
Block is the small character Component units of fineness ratio chinese character.In an example of the disclosure, predetermined Chinese character dismantling rule can be with
Rule is disassembled including predetermined Chinese character pattern structure.The predetermined Chinese character pattern structure dismantling rule can be any applicable based on the Chinese
The rule of word character form structure progress character dismantling.For example, the predetermined Chinese character pattern structure dismantling rule may include: Chinese character portion
Part construction rule, head and the tail decomposition rule or a combination thereof.For example, in website http://tool.httpcn.com/zi/ open
A kind of sample implementation of Chinese character pattern structure dismantling.It, can also be using other suitable in the other examples of the disclosure
Character dismantling rule each chinese character in text to be sorted is disassembled as the smaller character module of granularity.
In the disclosure, the text to be sorted can be pre-stored text to be sorted in document sorting apparatus,
It can be the text to be sorted that user inputs in real time, or from the received text to be sorted of external input device.
Fig. 2 shows an exemplary schematic diagrames of Chinese character according to an embodiment of the present disclosure dismantling process.Such as Fig. 2 institute
Show, text 201 to be sorted is " goods of trying to win sb.'s favor, come Taobao ", and it is beautiful that Ya woman Ren an ancient type of spoon shellfishes of 202 " of character module string carry out Rui Bao narrow-necked earthen jar Http " it is base
Character module string made of rule dismantling, character module string 203 " the non-Ha Rui Pottery Http of second head womanization Bei is beautiful " are constructed in Hanzi component
It is based on character module string and the non-Ha Rui Pottery of Ya womanization Bei of 204 " of character module string made of the dismantling of head and the tail decomposition rule
Http is beautiful " it is character module string made of the combination dismantling based on Hanzi component construction rule and head and the tail decomposition rule.
After as above treating classifying text and carrying out character module dismantling processing, in block 120, convolutional neural networks model is used
To carry out text classification processing to the character module string.Here, the convolutional neural networks model can be public using this field
Any suitable convolutional neural networks model, such as text CNN (TextCNN) model for knowing etc..
Fig. 3 shows the structural schematic diagram of convolutional neural networks model 300 according to an embodiment of the present disclosure.
As shown in figure 3, convolutional neural networks model 300 includes input layer 310, convolutional layer 320, pond layer 330 and classification
Layer 340.
Input layer 310 is configured as carrying out vectorization processing to character module string, each in character module string to obtain
The vector of character module indicates.Here, the effect of input layer 310 is that the character module string that will be inputted is converted into vector expression,
For example, character module string 204 " the non-Ha Rui Pottery Http of Ya womanization shellfishes is beautiful ", which is converted to corresponding vector, to be indicated.Concrete implementation
Method can refer to the pertinent literature of word2vec algorithm, alternatively, being realized using other algorithms well known in the art, herein
It repeats no more.
Convolutional layer 320 is configured as indicating to execute process of convolution to the vector of obtained each character module, to obtain
Semantic matrix corresponding to the character module string.It is, for example, possible to use the convolution kernel of suitable number and suitable size come to by
The vector of each character module indicates that the bivector matrix of composition carries out process of convolution, to obtain pair of the character module string
Answer semantic matrix.
Pond layer 330 is configured as executing obtained semantic matrix pondization calculating, to obtain the character module string
Corresponding semantic vector.In the disclosure, pond layer 330 can be used maximum value pond (max-pooling) algorithm come into
Row pondization calculates, or mean value pond (avg-pooling) algorithm can be used and calculate to carry out pondization.
Classification layer 440 is configured as executing classification processing to obtained semantic vector, with the determination text to be sorted
Classification results.In an example of the disclosure, classification layer 440 can use Softmax layers.
Fig. 4 shows the flow chart of text classification treatment process according to an embodiment of the present disclosure.
As shown in figure 4, firstly, the character module string obtained after Chinese character dismantling processing is input to convolution in block 410
The input layer of neural network model carries out vectorization processing, to obtain the vector table of each character module in character module string
Show.
Then, in block 420, the vector expression of obtained each character module is input in convolutional neural networks model
Convolutional layer carry out process of convolution, to obtain semantic matrix corresponding to character module string.
Then, in block 430, obtained semantic matrix is input to the pond layer in convolutional neural networks model to carry out
Pondization calculates, to obtain semantic vector corresponding to character module string.
Then, in block 440, obtained semantic vector is input to the classification layer in convolutional neural networks model to carry out
Classification processing, with the classification results of determination text to be sorted.
Fig. 5 shows the block diagram of document sorting apparatus 500 according to an embodiment of the present disclosure.As shown in figure 5, text point
Class device 500 includes Chinese character dismantling unit 510 and text classification unit 520.
Chinese character dismantling unit 510 is configured as treating classifying text progress Chinese character dismantling according to predetermined Chinese character dismantling rule,
To obtain character module string, each Chinese character in the text to be sorted is disassembled as at least one character module, the Chinese character
Module is the small character Component units of fineness ratio chinese character.In an example of the disclosure, the predetermined Chinese character dismantling rule
It then may include predetermined Chinese character pattern structure dismantling rule.The predetermined Chinese character pattern structure disassembles rule
Hanzi component construction rule, head and the tail decomposition rule or a combination thereof.Chinese character disassemble unit 510 operation can with reference to above with reference to
The operation of the block 110 of Fig. 1 description.
Text classification unit 520 is configured with convolutional neural networks model to carry out text classification to character module string
Processing.The operation of text classification unit 520 can be with reference to the operation above with reference to Fig. 1 block 120 described.
Above with reference to Fig. 1 to Fig. 5, carried out to according to the file classification method of the disclosure and the embodiment of document sorting apparatus
Description.
Using the file classification method and document sorting apparatus according to the disclosure, by by text to be sorted dismantling at by than
The character module string of the smaller character module composition of character granularity, then executes character module string using convolutional neural networks
Text classification processing.In above-mentioned text classification processing, due to executing volume for the smaller character module of granularity in convolutional layer
Thus product processing improves text point to can produce more interactive information compared to the process of convolution executed based on grouping
Class accuracy rate.In addition, part character module has competency, for example, the character module being made of radical of Chinese character, such as
" Lv " can indicate herbaceous plant attribute, to can introduce more friendships when executing process of convolution with other character modules
Mutual information thereby assists in and further increases text classification accuracy.
Above with reference to Fig. 1 to Fig. 5, carried out to according to the file classification method of the disclosure and the embodiment of document sorting apparatus
Description.Document sorting apparatus above can use hardware realization, can also be using the combination of software or hardware and software
To realize.
Fig. 6 shows the block diagram of the calculating equipment 600 according to an embodiment of the present disclosure for text classification.According to one
A embodiment, calculating equipment 600 may include at least one processor 610, which executes in computer
At least one computer-readable instruction of storage or coding is (that is, above-mentioned with software in readable storage medium storing program for executing (that is, memory 620)
The element that form is realized).
In one embodiment, computer executable instructions are stored in memory 620, make at least one when implemented
A processor 610: classifying text is treated according to predetermined Chinese character dismantling rule and carries out Chinese character dismantling, to obtain character module string, institute
It states each Chinese character in text to be sorted to be disassembled as at least one character module, the character module is fineness ratio chinese character
Small character Component units;And text classification processing is carried out to the character module string using convolutional neural networks model.
It should be understood that the computer executable instructions stored in memory 620 make at least one processing when implemented
Device 610 carries out the above various operations and functions described in conjunction with Fig. 1-5 in each embodiment of the disclosure.
In the disclosure, calculating equipment 600 can include but is not limited to: personal computer, server computer, work
It stands, desktop computer, laptop computer, notebook computer, mobile computing device, smart phone, tablet computer, bee
Cellular telephone, personal digital assistant (PDA), hand-held device, messaging devices, wearable calculating equipment, consumer-elcetronics devices etc.
Deng.
According to one embodiment, a kind of program product of such as non-transitory machine readable media is provided.Non-transitory
Machine readable media can have instruction (that is, above-mentioned element realized in a software form), which when executed by a machine, makes
It obtains machine and executes the above various operations and functions described in conjunction with Fig. 1-5 in each embodiment of the disclosure.Specifically, Ke Yiti
For being furnished with the system or device of readable storage medium storing program for executing, store on the readable storage medium storing program for executing any in realization above-described embodiment
The software program code of the function of embodiment, and read and execute the computer of the system or device or processor and be stored in
Instruction in the readable storage medium storing program for executing.
In this case, it is real that any one of above-described embodiment can be achieved in the program code itself read from readable medium
The function of example is applied, therefore the readable storage medium storing program for executing of machine readable code and storage machine readable code constitutes of the invention one
Point.
The embodiment of readable storage medium storing program for executing include floppy disk, hard disk, magneto-optic disk, CD (such as CD-ROM, CD-R, CD-RW,
DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), tape, non-volatile memory card and ROM.It selectively, can be by communication network
Network download program code from server computer or on cloud.
It will be appreciated by those skilled in the art that each embodiment disclosed above can be in the situation without departing from invention essence
Under make various changes and modifications.Therefore, protection scope of the present invention should be defined by the appended claims.
It should be noted that step and unit not all in above-mentioned each process and each system construction drawing is all necessary
, certain step or units can be ignored according to the actual needs.Each step execution sequence be not it is fixed, can be according to need
It is determined.Apparatus structure described in the various embodiments described above can be physical structure, be also possible to logical construction, that is, have
A little units may be realized by same physical entity, be realized alternatively, some units may divide by multiple physical entities, alternatively, can be with
It is realized jointly by certain components in multiple autonomous devices.
In the above various embodiments, hardware cell or module mechanically or can be realized electrically.For example, one
Hardware cell, module or processor may include permanent dedicated circuit or logic (such as special processor, FPGA or
ASIC) corresponding operating is completed.Hardware cell or processor can also include programmable logic or circuit (such as general processor or
Other programmable processors), interim setting can be carried out by software to complete corresponding operating.Concrete implementation mode is (mechanical
Mode or dedicated permanent circuit or the circuit being temporarily arranged) it can be determined based on cost and temporal consideration.
The specific embodiment illustrated above in conjunction with attached drawing describes exemplary embodiment, it is not intended that may be implemented
Or fall into all embodiments of the protection scope of claims." exemplary " meaning of the term used in the entire disclosure
" be used as example, example or illustration ", be not meant to than other embodiments " preferably " or " there is advantage ".For offer to institute
The purpose of the understanding of description technique, specific embodiment include detail.However, it is possible in the feelings without these details
Implement these technologies under condition.In some instances, known in order to avoid the concept to described embodiment causes indigestion
Construction and device be shown in block diagram form.
The foregoing description of present disclosure is provided so that any those of ordinary skill in this field can be realized or make
Use present disclosure.To those skilled in the art, the various modifications carried out to present disclosure are apparent
, also, can also answer generic principles defined herein in the case where not departing from the protection scope of present disclosure
For other modifications.Therefore, present disclosure is not limited to examples described herein and design, but disclosed herein with meeting
Principle and novel features widest scope it is consistent.