A traditional Chinese medicine symptom word segmentation method, computer readable storage medium and device

CN122528892BActive Publication Date: 2026-09-15SMART TRADITIONAL CHINESE MEDICINE TECH (GUANGDONG) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611007411.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-07-08
Publication Date
2026-09-15
Estimated Expiration
2046-07-08

AI Technical Summary

Technical Problem

[0003]为解决现有技术对中医症状分词准确性低的问题,本发明提出了一种中医症状分词方法、计算机可读存储介质及设备,实现中医症状描述的精准分词,便于中医诊疗科研分析与中医相关知识图谱构建

Benefits of technology

本发明提出一种中医症状分词方法、计算机可读存储介质及设备,以病历症状描述文本中任意标点符号为间隔,将病历症状描述文本分割为多个短句,并对每一个短句进行有效性校验,得到有效短句,基于预构建的多层级中医词典系统,对每个有效短句进行切分标注,得到带词性标注的词素序列。本发明在得到带词性标注的词素序列后,利用第一组合规则和第二组合规则,将所述带词性标注的词素序列中的词素组合,生成符合中医表达习惯的有效症状组合,然后对所述有效症状组合进行处理,得到完整症状术语,解决传统方式难以识别中医复合症状组合的问题,最后对完整症状术语进行合并去重,得到最终的中医症状术语,与传统通用分词技术相比,分词准确率高,便于中医诊疗科研分析与中医相关知识图谱构建。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122528892B_ABST
    Figure CN122528892B_ABST
Patent Text Reader

Abstract

The application provides a traditional Chinese medicine symptom word segmentation method, a computer readable storage medium and equipment, relates to the technical field of natural language processing, and takes any punctuation mark in a medical record symptom description text as an interval to divide the text into multiple short sentences, carries out effectiveness verification, obtains effective short sentences, cuts and labels each effective short sentence based on a pre-constructed multi-level traditional Chinese medicine dictionary system, and obtains a word sequence with part-of-speech tagging. After obtaining the word sequence with part-of-speech tagging, the application combines the words in the word sequence with part-of-speech tagging by using a first combination rule and a second combination rule, generates an effective symptom combination, processes the effective symptom combination, obtains a complete symptom term, solves the pain point that a traditional method is difficult to identify a traditional Chinese medicine compound symptom combination, and compared with the traditional technology, the word segmentation accuracy is high, and the traditional Chinese medicine diagnosis and treatment research analysis and traditional Chinese medicine related knowledge graph construction are facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing, and more specifically, to a method for segmenting words based on traditional Chinese medicine symptoms, a computer-readable storage medium, and a device. Background Technology

[0002] Traditional Chinese medicine (TCM) terminology and symptom descriptions have unique expressions that rarely appear in general corpora. Existing general Chinese word segmentation tools (such as Jieba Chinese Text Segmentation Library and High-performance Natural Language Processing (HanLP)) are typically trained on general corpora such as news, web pages, and novels. Their vocabulary and language patterns are biased towards everyday language and modern Chinese, making them unable to accurately identify TCM terminology and prone to incorrect word segmentation of TCM terminology and symptom descriptions. Summary of the Invention

[0003] To address the issue of low accuracy in TCM symptom segmentation in existing technologies, this invention proposes a TCM symptom segmentation method, a computer-readable storage medium, and a device to achieve accurate segmentation of TCM symptom descriptions, facilitating TCM diagnosis and treatment research analysis and the construction of TCM-related knowledge graphs.

[0004] To achieve the above-mentioned technical effects, the technical solution of the present invention is as follows: Firstly, this application proposes a method for segmenting TCM symptoms, which includes the following steps: obtaining the text of the symptom description in the medical record; The medical record symptom description text is divided into multiple short sentences using any punctuation mark in the text as a separator, and the validity of each short sentence is verified to obtain valid short sentences; Based on a pre-built multi-level TCM dictionary system, each valid short sentence is segmented and labeled to obtain a sequence of morphemes with part-of-speech tags; Using the first combination rule, the morphemes in the part-of-speech-tagged morpheme sequence are combined to generate effective symptom combinations that conform to the expression habits of traditional Chinese medicine; The effective symptom combinations are processed using the second combination rule to obtain complete symptom terms; Based on a multi-level TCM dictionary system, complete symptom terms are merged and duplicated to obtain the final TCM symptom terms.

[0005] Preferably, the parts of speech tagged include: subject words, subordinate words, adverbial words, modifiers, degree words, locative words, whole words, and feminine words; The multi-level TCM dictionary system includes: a symptom morpheme database, a high-dimensional TCM terminology attribute vector table, and a TCM outpatient medical record writing habit word order rule database; in the symptom morpheme database, each morpheme has been pre-labeled with a part of speech and has a unique ID, and is pre-bound to the corresponding attribute vector in the high-dimensional TCM terminology attribute vector table; the symptom morpheme database also stores the corresponding synonym morpheme variants of each morpheme.

[0006] Preferably, the validity check for each short sentence includes: If any short sentence simultaneously satisfies the following conditions: it has only one valid part of speech or no valid part of speech, does not contain any valid whole words or valid single morphemes, and the part of speech it contains is not a combination of "modifier and degree word", then remove the punctuation mark that serves as the separator, merge the short sentence with the preceding short sentence next to it, and obtain a valid short sentence; otherwise, the short sentence is considered a valid short sentence. The effective parts of speech include main words, subordinate words, and adverbial words; the effective whole words are independent and indivisible complete TCM symptom terms; the effective morphemes are the smallest indivisible effective semantic morphemes with part-of-speech tags in the symptom morpheme library. The pre-built multi-level TCM dictionary system segments and annotates each valid short phrase, including: The forward maximum matching method is used to segment and label each valid phrase, resulting in a sequence of morphemes after segmentation of each valid phrase; Based on the part-of-speech tagging of each morpheme in the symptom morpheme library, the part-of-speech tagging of each morpheme in the morpheme sequence after each effective short sentence segmentation is performed. Based on the part-of-speech tagging of the morphemes, noise reduction processing is carried out to obtain the final morpheme sequence with part-of-speech tagging.

[0007] Preferably, the first combination rule is a sequential combination rule, and before assembling the part-of-speech-tagged morpheme sequence using the first combination rule, the following steps are included: Based on the morphemes in the part-of-speech tagged morpheme sequence, a current candidate combination is generated. The morphemes used to generate the current candidate combination do not include those tagged as modifiers or degree words in the morpheme sequence. The current candidate combination includes four-part candidate combinations, three-part candidate combinations, two-part candidate combinations, and one-part candidate combinations. A four-part candidate combination represents a candidate combination composed of four consecutive morphemes; a three-part candidate combination represents a candidate combination composed of three consecutive morphemes; a two-part candidate combination represents a candidate combination composed of two consecutive morphemes; and a one-part candidate combination represents a candidate combination composed of a single morpheme. The morphemes used to generate the current candidate combination will match and verify the current candidate combination with the symptom morpheme library according to the first matching verification priority. During the matching verification, the first matching verification priority is in the following order from high to low: first order of four-pair candidate combinations, second order of four-pair candidate combinations, first order of three-pair candidate combinations, second order of three-pair candidate combinations, first order of two-pair candidate combinations, second order of two-pair candidate combinations, and first order of one-pair candidate combinations. The first order is the order in which the parts of speech are most common in TCM clinical practice; the second order is the order in which special word orders are arranged with a lower frequency of commonity than the first order.

[0008] Preferably, the step of combining the morphemes in the part-of-speech-tagged sequence using the first combination rule includes: S41: Initialize scan pointer i; S42: Based on the symptom morpheme library, starting from the current scanning pointer i, according to the current candidate combination pointed to by the scanning pointer, the current candidate combination is matched and verified in descending order of the first matching verification priority. If the match is successful, the current candidate combination is taken as a valid symptom combination, and the scanning pointer i is moved backward to the position corresponding to the number of morphemes contained in the current candidate combination, and 44 is executed; otherwise, 43 is executed. S43: If the order of the first matching check priority corresponding to the current candidate combination is not the same as the order of the first matching check priority corresponding to the first-order candidate combination, switch to the next candidate combination in the current matching check priority sorting to obtain the new current candidate combination, and return to S42; if the order of the matching check priority corresponding to the current candidate combination is the same as the order of the first matching check priority corresponding to the first-order candidate combination, then the lexicon corresponding to the current candidate combination is an invalid redundant lexicon, discard it, move the scan pointer i backward to the position corresponding to the number of lexicons contained in the current candidate combination, and execute S44; S44: Check the remaining uncombined morphemes in the morpheme sequence: If two or more morphemes with the same attribute are consecutively listed side by side, then the currently combined morpheme and the subsequent non-consecutive morphemes are concatenated across positions, and a matching verification is performed based on the symptom morpheme database. If the match is successful, the combination formed by concatenating the currently combined morpheme and the subsequent non-consecutive morphemes across positions is updated as a new valid symptom combination, and the scanning pointer position is adjusted; if the match fails, the valid symptom combination obtained in S42 is retained. If no parallel morphemes with the same attribute exist, execute S45; S45: If the position pointed to by the scanning pointer i exceeds the end of the part-of-speech morpheme sequence, output the valid symptom combination; otherwise, based on the morphemes in the part-of-speech morpheme sequence, generate the next current candidate combination and return to S42.

[0009] Preferably, the second combination rule is a clinical manifestation combination rule; multiple effective symptom combinations are used as basic units, and candidate unit combination sequences are generated based on the basic units and morphemes in the morpheme sequence that are labeled as modifiers and degree words; the candidate unit combination sequence includes multiple candidate unit combinations, including: modifier-basic unit combination, degree word-basic unit combination, modifier-basic unit-degree word combination, and modifier-degree word combination; the modifier-basic unit combination consists of two parts: modifier and basic unit, the degree word-basic unit combination consists of two parts: degree word and basic unit, the modifier-basic unit-degree word combination consists of three parts: modifier, basic unit, and degree word, and the modifier-degree word combination consists of two parts: modifier and degree word.

[0010] Construct a second matching verification priority order, which includes: The more components a candidate unit combination has, the higher its priority. With the same number of components, the candidate unit combination that conforms to the first order has a higher priority than the current candidate combination that conforms to the second order. The first order is the order in which the parts of speech in TCM clinical practice are most common; the second order is the order in which the parts of speech in TCM clinical practice are less common than the first order.

[0011] Preferably, the process of using the second combination rule to process the effective symptom combinations to obtain complete symptom terms includes: S51: Based on the basic unit and the morphemes in the morpheme sequence that are labeled as modifiers and degree words, construct a candidate unit combination sequence. The candidate unit combination sequence includes multiple candidate unit combinations. The length of the candidate unit combination sequence is L, and initialize the scan pointer i to 0. S52: Determine whether the current candidate unit combination pointed to by the current scan pointer i belongs to the candidate unit combination sequence. If yes, execute S53; otherwise, execute S55. S53: Using the rule base for the word order of TCM outpatient medical records, perform a matching verification on the current candidate unit combination. If the matching verification is successful, treat the current candidate unit combination as a complete symptom term, increment the value of the current scan pointer i by the number of components included in the current candidate unit combination, and execute S54; otherwise, execute S55. S54: If i is greater than or equal to L, terminate and output the complete symptom term; if i is less than L, return to S52. S55: If the current candidate unit combination is not the lowest priority candidate unit combination in the second matching verification priority order, switch to the next priority candidate unit combination in the second matching verification priority order, generate a new current candidate unit combination, and return to execute S52; if the current candidate unit combination is the lowest priority candidate unit combination in the second matching verification priority order, the current candidate unit combination is invalid and redundant, discard it, move the scan pointer i one position to the right, and return to S54.

[0012] Preferably, if two or more morphemes with the same part of speech appear side by side in the candidate unit combination sequence, then a cross-position combination is made across the side by side morphemes; For all successfully matched candidate unit combinations, uniform word ordering is performed, including: Check the positions of morphemes labeled as modifiers and degree words in the basic unit and the morpheme sequence in the candidate unit combination. If a modifier or degree word appears after the basic unit, move the modifier or degree word to the front of the basic unit.

[0013] Secondly, this application proposes a TCM symptom segmentation device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the TCM symptom segmentation method.

[0014] Thirdly, this application proposes a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the traditional Chinese medicine symptom segmentation method.

[0015] Compared with the prior art, the beneficial effects of the technical solution of the present invention are: This invention proposes a method for segmenting TCM symptoms, a computer-readable storage medium, and a device. The method divides the medical record symptom description text into multiple short sentences using arbitrary punctuation marks as intervals, and verifies the validity of each sentence to obtain valid sentences. Based on a pre-built multi-level TCM dictionary system, each valid sentence is segmented and labeled to obtain a sequence of morphemes with part-of-speech tags. After obtaining the morpheme sequence with part-of-speech tags, this invention uses a first combination rule and a second combination rule to combine the morphemes in the morpheme sequence with part-of-speech tags to generate valid symptom combinations that conform to TCM expression habits. These valid symptom combinations are then processed to obtain complete symptom terms, solving the problem of traditional methods' difficulty in identifying complex TCM symptom combinations. Finally, the complete symptom terms are merged and deduplicated to obtain the final TCM symptom terms. Compared with traditional general word segmentation techniques, this method has a higher word segmentation accuracy, facilitating TCM diagnosis and treatment research analysis and the construction of TCM-related knowledge graphs. Attached Figure Description

[0016] Figure 1 A flowchart illustrating the TCM symptom segmentation method proposed in this embodiment of the invention; Figure 2 This is a schematic diagram illustrating the process of segmenting and labeling each valid short sentence as proposed in this invention. Figure 3 This diagram illustrates the structure of the TCM symptom segmentation device proposed in this embodiment of the invention. Detailed Implementation

[0017] The accompanying drawings are for illustrative purposes only and should not be construed as limiting the scope of this patent. To better illustrate this embodiment, some parts of the accompanying drawings may be omitted, enlarged, or reduced, and do not represent the actual dimensions; It is understandable to those skilled in the art that some well-known details may be omitted from the accompanying drawings.

[0018] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0019] The positional relationships depicted in the accompanying drawings are for illustrative purposes only and should not be construed as limiting this patent. Example 1 like Figure 1 As shown, this embodiment proposes a method for segmenting TCM symptoms, including the following steps: S1: Obtain the symptom description text from the medical record.

[0020] S2: Divide the medical record symptom description text into multiple short sentences using any punctuation mark in the text as the interval, and perform validity checks on each short sentence to obtain valid short sentences.

[0021] S3: Based on a pre-built multi-level TCM dictionary system, each valid short sentence is segmented and labeled to obtain a sequence of morphemes with part-of-speech tags.

[0022] S4: Using the first combination rule, combine the morphemes in the part-of-speech-tagged morpheme sequence to generate an effective symptom combination that conforms to the expression habits of traditional Chinese medicine.

[0023] S5: Using the second combination rule, the effective symptom combination is processed to obtain complete symptom terms; S6: Based on a multi-level TCM dictionary system, complete symptom terms are merged and duplicated to obtain the final TCM symptom terms.

[0024] In this embodiment, the punctuation marks in the symptom description text of the medical record include all punctuation marks that can be used to break sentences, separate parallel items, or pause in tone in the context of TCM electronic medical records, such as commas, pause marks, semicolons, forward slashes, spaces, exclamation marks, etc. In actual TCM outpatient medical records, the text format entered by doctors or patients is not standardized and may use a mixture of punctuation marks. Using any punctuation mark as a separator can maximize the coverage of real data, ensure that any punctuation mark can trigger segmentation, and avoid omissions. A long unstructured text, such as "headache, chills, nasal congestion and runny nose," can be segmented into several relatively independent and semantically more focused short sentences: "headache," "chills," and "nasal congestion and runny nose."

[0025] In this embodiment, a multi-level TCM dictionary system is pre-built to provide a knowledge foundation for all subsequent word segmentation processing, solving the problems of general word segmentation lacking a TCM-specific dictionary and domain-specific rules. In this embodiment, the multi-level TCM dictionary system includes: a symptom morpheme database, a high-dimensional TCM terminology attribute vector table, and a TCM outpatient medical record writing habit word order rule database. In specific implementation, the symptom morpheme database, high-dimensional TCM terminology attribute vector table, and TCM outpatient medical record writing habit word order rule database are pre-built into the computer device's memory, rather than the traditional natural language word segmentation system which only has a "segmentation database" and a "synonym database."

[0026] The symptom morpheme database contains over 6.3 million standard symptom description morphemes, providing highly refined standardization for various symptom descriptions. It covers morpheme descriptions of multiple semantic components, including TCM diagnosis and somatic symptoms. For example, it offers extremely fine-grained segmentation for different tongue diagnosis features, encompassing two main categories: tongue color and tongue shape. The tongue color dimension is further subdivided by color family and intensity: for instance, the red family is subdivided into bright red, light red, deep red, and dark red; the yellow family is subdivided into yellow, dark yellow, bright yellow, pale yellow, and deep yellow; and it also covers white, blue, purple, black, and brown tongue colors, each corresponding to different levels of descriptive morphemes. The tongue shape dimension is also segmented into descriptions of different forms: for example, changes in tongue size include tongue enlargement and tongue volume increase; tongue abnormalities include tongue atrophy, tongue contracture, tongue spasm, and tongue shortening.

[0027] The high-dimensional TCM terminology attribute vector table proposed in this embodiment corresponds to 147 dimensions of attribute vectors for each TCM term, such as: location dimension: coordinates of various parts of the body (internal and external); physiological dimension: physiological state, excretions, etc.; symptom dimension: sensations such as pain, itching, numbness, etc.; attribute dimension: color, shape, size, texture, etc.; severity dimension: mild, moderate, severe, extremely severe; time dimension: duration, attack pattern, etc., totaling 147 dimensions. More specific details of the high-dimensional TCM terminology attribute vector table will not be elaborated here. An example of the data structure of the high-dimensional TCM terminology attribute vector table can be found here: { "term": "pain", "vector": { "Dimension_Location": [0, 1, 0, ...], "Dimension_Perception": [1, 0, 0, ...], "Dimension_Degree": [0, 1, 0, ...] }, Synonyms: ["pain", "ache", "discomfort", "aching", "stabbing pain"] }

[0028] The word order rule base of traditional Chinese medicine outpatient medical record writing habits refers to 574 different word order patterns finally obtained after performing corpus statistics on a large number of traditional Chinese medicine outpatient medical records and combining 11 types of semantic components including location, tissue, secretion, physiology, foreign body, state, condition, time, frequency, degree and general word for combination constraint. It includes 574 items of rules for traditional Chinese medicine outpatient medical record writing habits, for example: (1) Combination rule of location + state: such as "head pain", "stomach distending pain"; (2) Combination rule of state + degree: such as "severe pain", "slight discomfort"; (3) Combination rule of location + secretion: such as "nasal secretion", "oral odor"; (4) Special word order rule: such as "pain with fixed location", "occurring at intervals".

[0029] For an example of the data structure of the word order rule base of traditional Chinese medicine outpatient medical record writing habits, please refer to: {"rule_id": 1, "pattern": ["location", "symptom"], "example": "headache, stomachache, abdominal pain", "priority": 1 }.

[0030] In specific implementation, each morpheme in the pre-stored symptom morpheme base has been pre-annotated with part of speech, has a unique ID, and is pre-bound to the corresponding attribute vector of the high-dimensional traditional Chinese medical term attribute vector table, that is, each morpheme is assigned a unique identifier, and the exact coordinate thereof in the 147-dimensional vector space is pre-calculated and associated with each morpheme in advance. When a computer device identifies the morpheme "pain" in the word segmentation stage, it can immediately obtain the attribute vectors of 147 dimensions corresponding to "pain" without temporary calculation. This vector has encoded the attribute values of "pain" on all 147 preset dimensions (such as location, sensation type, intensity, temporal characteristics, etc.).

[0031] The symptom morpheme base also stores corresponding synonym morpheme variants of each morpheme. Wherein, the synonym morpheme variants refer to different words that express the same core semantics in the context of traditional Chinese medicine. The symptom morpheme base associates the synonym morpheme variants to the same standard morpheme, so as to ensure that computer equipment can identify different expressions and perform normalization processing. For example, the standard morpheme: urine, the synonym morpheme variants thereof can be "xiaobian" (urine) and "sou" (urine).

[0032] The parts of speech tagged include: subject words, subordinate words, adverbs, modifiers, degree words, locative words, holistic words, and negative words. Subject words are the core carriers of symptoms, often referring to body parts, pathological products, or core sensations; they form the framework of the symptoms, such as urination, phlegm, pain, sweating, and rash. Subordinate words are subordinate words that precisely define the location of the subject, often referring to anatomical or functional locations unique to Traditional Chinese Medicine, such as *wan* (stomach), *chin*, *qiao* (orifices), and *jiao* (upper / middle / lower *jiao*). Adverbs describe the dynamics or state of symptoms, such as *chang* (frequently), *jian* (gradually), *zhou* (suddenly), and *ou* (occasionally). Modifiers describe conditions, time, frequency, etc., such as *banye* (night), *jingqi* (menstruation), *zhi* (always), and *jian* (progressive). Degree words describe the severity or quantity of symptoms, such as *wei* (mild), *shen* (severe), *ju* (intense), *shuo* (few), and *duo* (many). Locative words are basic spatial words that indicate relative position or direction, such as up, down, left, right, inside, outside, front, and back. Feminine words are words that indicate the absence or negation of symptoms, such as none, not, not, and not.

[0033] In this embodiment, the validity of each short sentence is verified, including: If any short sentence simultaneously satisfies the following conditions: it has only one valid part of speech or no valid part of speech, does not contain any valid whole words or valid single morphemes, and the existing part of speech does not belong to the combination of "modifier and degree word", then remove the punctuation mark used as a separator, merge the short sentence with the adjacent preceding short sentence, and obtain a valid short sentence; otherwise, the short sentence is considered a valid short sentence; where valid part of speech includes subject words, subordinate words, and adverbial words; valid whole words are independent and indivisible complete TCM symptom terms; valid single morphemes are the single smallest indivisible valid semantic morphemes with part-of-speech annotation in the symptom morpheme library.

[0034] The above three conditions are: (1) there is only one valid part of speech or there is no valid part of speech; (2) it does not include any valid whole words or valid single morphemes; (3) the existing part of speech does not belong to the combination of "modifier and degree word". If all three conditions are met, it means that a single sentence segment is invalid. The punctuation mark separating the sentences can be removed, and then the sentence can be merged with the sentence to the left (i.e., the sentence immediately preceding the sentence separated by the punctuation mark) to obtain a valid sentence. For example, in the sentence "abdominal rash with itching and red color," "red color" meets all the above conditions, so the comma can be removed, and the sentence can be merged with the preceding sentence "abdominal rash with itching" to obtain the valid sentence "abdominal rash with itching and red color." However, if only one of the three conditions is not met, such as in the sentence "abdominal rash with itching and red color, worse at night," the part of speech "worsening at night" belongs to the combination of "modifier and degree word," which does not meet the condition that "the part of speech does not belong to the combination of "modifier and degree word." Therefore, the comma before "worsening at night" cannot be removed from the sentence "abdominal rash with itching and red color, worse at night," and "worsening at night" can be a valid sentence on its own. For another example, in the sentence "abdominal rash with itching and fever," "fever" is a valid morpheme, so the comma before "fever" is not removed.

[0035] This process can organize unstructured long raw text into the smallest processing units suitable for subsequent rule combinations, filter noise in advance, and reduce the complexity of subsequent combinations.

[0036] In this embodiment, as Figure 2 As shown, based on a pre-built multi-level TCM dictionary system, each valid short sentence is segmented and annotated, including: S31: Use the forward maximum matching method to segment and label each valid phrase to obtain the word sequence after segmentation of each valid phrase; S32: Based on the part-of-speech tagging of each morpheme in the symptom morpheme library, tag each morpheme in the morpheme sequence after segmentation of each effective short sentence with part-of-speech tagging. Based on the part-of-speech tagging of the morphemes, perform noise reduction processing to obtain the final morpheme sequence with part-of-speech tagging.

[0037] By adopting the above steps, plain text strings are converted into morpheme sequences with part-of-speech tags. Furthermore, some morphemes, such as those whose part of speech cannot be determined or which are negative words, are denoised. For example, in the phrase "no fever, no cough," "no" is a negative word. Removing the sentence segment containing "no" can solve the problem of incorrect segmentation of TCM professional terms by general word segmentation and provide part-of-speech basis for subsequent rule combinations.

[0038] In this embodiment, each valid short sentence is scanned sequentially, and the longest valid morpheme in the multi-level traditional Chinese medicine dictionary system is preferentially matched based on the forward maximum matching method to complete the segmentation of the whole sentence to obtain a morpheme sequence. Each morpheme is labeled with part of speech against the multi-level traditional Chinese medicine dictionary system to distinguish categories such as main words, auxiliary words, secondary words, modifiers, and degree words, and a morpheme sequence with part-of-speech attributes is output. For example, four morphemes are obtained after segmentation: less, urine, profuse, tears; according to the multi-level traditional Chinese medicine dictionary system, part-of-speech labeling results in the sequence: less (secondary word), urine (main word), profuse (secondary word), tears (main word).

[0039] In this embodiment, the first combination rule is the sequential combination rule. Based on part of speech and the sequential rule, scattered morphemes are assembled into independent symptoms that conform to the expression habits of traditional Chinese medicine, which solves the problem that existing methods are difficult to identify compound traditional Chinese medicine symptoms. The second combination rule is a combination rule based on clinical manifestations. After obtaining independent symptoms through the first combination rule, it further processes the modification and coordinate relationships among multiple symptoms, completes symptom attribute information, and obtains complete symptom terms that conform to the writing habits of traditional Chinese medicine.

[0040] In this embodiment, the complete symptom terms are mapped to a high-dimensional attribute vector table of traditional Chinese medicine terms to match synonymous terms in the dictionary; identical and synonymous symptoms are deduplicated and merged, invalid terms that fail to be matched are discarded, and then a streamlined and standardized list of traditional Chinese medicine symptom terms is output, which can be directly used for downstream tasks such as subsequent syndrome identification and clinical auxiliary diagnosis.

[0041] Embodiment 2 In this embodiment, before assembling the part-of-speech labeled morpheme sequence by using the first combination rule, the method includes: Based on morphemes in the part-of-speech labeled morpheme sequence, a current candidate combination is generated, wherein the morphemes used to generate the current candidate combination do not include morphemes labeled as modifiers and morphemes labeled as degree words in the morpheme sequence; the current candidate combination includes four-morpheme candidate combinations, three-morpheme candidate combinations, two-morpheme candidate combinations and single-morpheme candidate combinations, the four-morpheme candidate combination refers to a candidate combination spliced by four consecutive morphemes, the three-morpheme candidate combination refers to a candidate combination spliced by three consecutive morphemes, the two-morpheme candidate combination refers to a candidate combination spliced by two consecutive morphemes, and the single-morpheme candidate combination refers to a candidate combination spliced by a single morpheme.

[0042] The morphemes used to generate the current candidate combination will match and verify the current candidate combination with the symptom morpheme library according to the first matching verification priority. During the matching verification, the first matching verification priority is in the following order from high to low: first order of four-pair candidate combinations, second order of four-pair candidate combinations, first order of three-pair candidate combinations, second order of three-pair candidate combinations, first order of two-pair candidate combinations, second order of two-pair candidate combinations, and first order of one-pair candidate combinations. The first order is the order in which the parts of speech are most common in TCM clinical practice; the second order is the order in which special word orders are arranged with a lower frequency of commonity than the first order.

[0043] In existing TCM outpatient medical records, "link" refers to a composition consisting of effective word elements. Combinations with more than "four links" are basically non-existent. Therefore, when generating the current candidate combination, the highest priority four-link candidate combination is considered. If "four links" do not exist, "three links", "two links", and "one link" are considered in sequence.

[0044] In this embodiment, the first or second order is not based on a single morpheme, but rather on the priority of different parts of speech arrangement patterns. The first order is the most common and frequent word order for this type of word collocation in TCM clinical outpatient medical records, and it is the first to attempt to match it. The second order is a special or inverted word order that is rarely used in word collocations, and its commonality is much lower than the first order. It is only attempted after the first order fails to match. For example, the most common two-part combination is "modifier or degree word + core subject word". For example, the first order: less (adverb) + urine (subject word) = less urine. This order conforms to general writing habits. The second order: urine (subject word) + less (adverb) = less urine, which is an inverted form and has low clinical commonality.

[0045] Using the first combination rule, the morphemes in the part-of-speech-tagged morpheme sequence are combined, including: S41: Initialize scan pointer i; S42: Based on the symptom morpheme library, starting from the current scanning pointer i, according to the current candidate combination pointed to by the scanning pointer, the current candidate combination is matched and verified in descending order of the first matching verification priority. If the match is successful, the current candidate combination is taken as a valid symptom combination, and the scanning pointer i is moved backward to the position corresponding to the number of morphemes contained in the current candidate combination, and S44 is executed; otherwise, S43 is executed. S43: if the order in the first matching check priority corresponding to the current candidate combination is not the order in the first matching check priority corresponding to the one-unit candidate combination of the first order, switch to a new candidate combination corresponding to the next subsequent order in the current matching check priority ranking, obtain a new current candidate combination, and return to S42; if the matching check priority order corresponding to the current candidate combination is the order in the first matching check priority corresponding to the one-unit candidate combination of the first order, then the morpheme corresponding to the current candidate combination is an invalid redundant morpheme, which is discarded, the scanning pointer i is moved backward by a position corresponding to the number of morphemes contained in the current candidate combination, and step S44 is executed; S44: checking uncombined morphemes remaining in the morpheme sequence: if there are two or more consecutive juxtaposed morphemes with the same attribute, jumping across the juxtaposed morphemes, cross-position splicing the currently combined morphemes and the discontinuous subsequent morphemes, performing matching check based on the symptom morpheme library, if the matching is successful, updating the combination formed by cross-position splicing the currently combined morphemes and the discontinuous subsequent morphemes as a new valid symptom combination, and adjusting the position of the scanning pointer; if the matching fails, retaining the valid symptom combination obtained in S42; if there is no juxtaposed morpheme with the same attribute, execute S45; S45: if the position pointed to by the scanning pointer i exceeds the end of the part-of-speech tagged morpheme sequence, outputting the valid symptom combination; otherwise, generating a next current candidate combination based on the morphemes in the part-of-speech tagged morpheme sequence, and returning to S42.

[0046] for example, in specific implementation, assuming that the part-of-speech tagged morpheme sequence is determined as: [less (adverbial-position morpheme), urine (main-body morpheme), profuse (adverbial-position morpheme), sweat (main-body morpheme)], with a total length of 4 and an index range of 0~3.

[0047] first step S41 is executed, the scanning pointer i is initialized, i is set to 0, pointing to the first morpheme "less" to be combined.

[0048] S42: starting from the current scanning pointer i, performing matching check on the current candidate combination from high to low according to the first matching check priority, starting from i=0, trying sequentially according to the four-unit candidate combination of the first order, the four-unit candidate combination of the second order, the three-unit candidate combination of the first order, the three-unit candidate combination of the second order, the two-unit candidate combination of the first order, the two-unit candidate combination of the second order and the one-unit candidate combination of the first order in the first matching check priority: (1) the first candidate: the four-unit candidate combination of the first order takes four consecutive morphemes and splices them into "less + urine + profuse + sweat", the part-of-speech arrangement is: adverbial-position morpheme + main-body morpheme + adverbial-position morpheme + main-body morpheme, which does not conform to the first order of common arrangement in traditional Chinese medicine clinical practice, matching is performed through the symptom morpheme library, the matching fails, and step S43 is executed.

[0049] (2) S43: if the current priority corresponds to a one-group candidate combination that is not the first order at the end, switch to the next priority: a four-group candidate combination of the second order, adjust the arrangement to generate second-order candidates, perform matching through the symptom morpheme library, match with the morpheme combination rules and symptom combinations in the symptom morpheme library, if all matching fails, execute S43 again to switch to the next priority.

[0050] (3) Switch to the next priority: a three-group candidate combination of the first order, take three consecutive morphemes starting from i=0 and splice them into "shao niao duo", whose part-of-speech arrangement is: auxiliary position word + main word + auxiliary position word, which does not conform to the first order of common arrangements in traditional Chinese medicine clinical practice, thus matching fails, and S43 switches to the next priority.

[0051] (4) Switch to the next priority: a three-group candidate combination of the second order, take three consecutive morphemes starting from i=0, adjust them to the second-order arrangement, obtain the candidate "urine + excessive + sweat", send it to the morpheme library for matching, the combination does not exist in the morpheme library, thus combination fails, and S43 switches to the next priority.

[0052] (5) Switch to the next priority: a two-group candidate combination of the first order, take two consecutive morphemes starting from i=0 and splice them into "less + urine = oliguria", whose part-of-speech arrangement is: auxiliary position word + main word, which conforms to the first order, the most common word order in clinical practice, matching is performed through the symptom morpheme library, and matching succeeds. "Oliguria" is recorded as a valid symptom combination, the current combination contains 2 morphemes, at this time i=0+2=2, the scanning pointer i is moved backward by 2 positions, and S44 is executed.

[0053] S44: check whether there are consecutively juxtaposed morphemes with the same part of speech or the same attribute among the remaining uncombined morphemes in the sequence [less (auxiliary position word), urine (main word), excessive (auxiliary position word), sweat (main word)]. In this embodiment, the remaining uncombined morphemes are "excessive (auxiliary position word), sweat (main word)", the two morphemes have different parts of speech, and there are no two or more morphemes of the same attribute juxtaposed, therefore, S45 is directly executed.

[0054] S45: judge that the scanning pointer position i=2, the total length is 4, the end position is 4, i=2, i<4, which does not exceed the end of the morpheme sequence, therefore, generate the next current candidate combination, return to S42 to start a new round of combination.

[0055] The second round of combination: i=2, pointing to the morpheme "excessive", execute S42 in the current round of combination, start from i=2 and match the remaining only 2 morphemes according to priority, which does not meet the length requirements of four-group and three-group combinations, directly degrade to the two-group candidate combination of the first order: take two consecutive morphemes and splice them into "excessive + sweat = hyperhidrosis", whose part-of-speech arrangement is: auxiliary position word + main word, which conforms to the first order, matching is performed through the symptom morpheme library, and matching succeeds. "Hyperhidrosis" is recorded as a valid symptom combination, the scanning pointer i is moved backward by 2 positions, at this time i=2+2=4, and S44 is executed.

[0056] S44: Check the remaining uncombined morphemes in the sequence [less (adverb), urine (subject), more (adverb), sweat (subject)], check that there are no remaining uncombined words, and there are no parallel words with the same attribute, then proceed to S45.

[0057] S45: Determine the position of the scanning pointer. i=4, which is about to exceed the end of the morpheme sequence. Terminate the loop and output the valid symptom combination: [oliguria, hyperhidrosis].

[0058] In this embodiment, the second combination rule is a clinical manifestation combination rule; multiple effective symptom combinations are used as basic units, and candidate unit combination sequences are generated based on the basic units and the morphemes in the morpheme sequence that are labeled as modifiers and degree words; the candidate unit combination sequence includes multiple candidate unit combinations, including: modifier-basic unit combination, degree word-basic unit combination, modifier-basic unit-degree word combination, and modifier-degree word combination; the modifier-basic unit combination consists of a modifier and a basic unit, the degree word-basic unit combination consists of a degree word and a basic unit, the modifier-basic unit-degree word combination consists of a modifier, a basic unit, and a degree word, and the modifier-degree word combination consists of a modifier and a degree word.

[0059] Construct a second matching verification priority order, which includes: The more components a candidate unit combination has, the higher its priority. With the same number of components, the candidate unit combination that conforms to the first order has a higher priority than the current candidate combination that conforms to the second order. The first order is the order in which the parts of speech in TCM clinical practice are most common; the second order is the order in which the parts of speech in TCM clinical practice are less common than the first order.

[0060] The effective symptom combinations are processed using the second combination rule to obtain complete symptom terms, including: S51: Based on the basic unit and the morphemes in the morpheme sequence that are labeled as modifiers and degree words, construct a candidate unit combination sequence. The candidate unit combination sequence includes multiple candidate unit combinations. The length of the candidate unit combination sequence is L, and initialize the scan pointer i to 0. S52: Determine whether the current candidate unit combination pointed to by the current scan pointer i belongs to the candidate unit combination sequence. If yes, execute S53; otherwise, execute S55. S53: Using the rule base for the word order of TCM outpatient medical records, perform a matching verification on the current candidate unit combination. If the matching verification is successful, treat the current candidate unit combination as a complete symptom term, increment the value of the current scan pointer i by the number of components included in the current candidate unit combination, and execute S54; otherwise, execute S55. S54: If i is greater than or equal to L, terminate and output the complete symptom term; if i is less than L, return to S52. S55: If the current candidate unit combination is not the lowest priority candidate unit combination in the second matching verification priority order, switch to the next priority candidate unit combination in the second matching verification priority order, generate a new current candidate unit combination, and return to execute S52; if the current candidate unit combination is the lowest priority candidate unit combination in the second matching verification priority order, the current candidate unit combination is invalid and redundant, discard it, move the scan pointer i one position to the right, and return to S54.

[0061] If two or more morphemes with the same part of speech appear side by side in the candidate unit combination sequence, then cross-position combination is performed across the side by side morphemes; For all successfully matched candidate unit combinations, uniform word ordering is performed, including: Check the positions of morphemes labeled as modifiers and degree words in the basic unit and the morpheme sequence in the candidate unit combination. If a modifier or degree word appears after the basic unit, move the modifier or degree word to the front of the basic unit.

[0062] Here's an example of executing the second rule combination using "frequently urinates less during the day". Under the basic unit "less urinate" output from the first rule combination, the candidate unit combination sequence is constructed by concatenating the basic unit "less urinate" with morphemes whose parts of speech are modifiers in their original order. Here, "frequently" (a modifier indicating frequency) and "daytime" (a modifier indicating time) are both morphemes whose parts of speech are modifiers. Therefore, if two or more morphemes with the same part of speech appear side-by-side in the candidate unit combination sequence, a cross-position combination is performed across these morphemes to obtain the candidate unit combinations: "frequently (modifier) ​​+ less urinate (basic unit), daytime (modifier) ​​+ less urinate (basic unit), less..." The candidate unit combination is defined as "urine (basic unit) + frequent (modifier), oliguria (basic unit) + daytime (modifier)". However, "oliguria (basic unit) + frequent (modifier), oliguria (basic unit) + daytime (modifier)" does not belong to any of the following combinations: "modifier-basic unit combination", "degree word-basic unit combination", "modifier-basic unit-degree word combination", or "modifier-degree word combination". If the current candidate unit combination pointed to by the current scan pointer i is one of these combinations, check if it is the lowest priority candidate unit combination. If so, proceed with the current candidate unit combination. If a candidate unit combination is deemed invalid and redundant, it is discarded. Then, the value of the scanning pointer i is increased by the number of components included in the current candidate unit combination ("oliguria (basic unit) + frequent (modifier)" includes two parts, with a value of 2). The scanning pointer i is checked to see if it reaches the end of the sequence. If it does, the process terminates. Otherwise, it is determined whether the current candidate unit combination pointed to by the scanning pointer i belongs to the candidate unit combination sequence. If it currently points to the candidate combination "frequent (modifier) ​​+ oliguria (basic unit)," and "frequent (modifier) ​​+ oliguria (basic unit)" does belong to the candidate unit combination sequence, then the process continues. By using the rule library of word order for writing TCM outpatient medical records, the current candidate unit combination is matched and verified. If it conforms to the writing habits of TCM outpatient medical records, the current candidate unit combination can be used as a complete symptom term. Then, the value of the scanning pointer i is increased by the number of components included in the current candidate unit combination ("frequent (modifier) ​​+ oliguria (basic unit)" includes two parts, with a number of 2). It is checked whether the current scanning pointer i scans to the end of the sequence. If it does, the process is terminated. Otherwise, the above process is continued to judge. Finally, the complete symptom terms "frequent (modifier) ​​+ oliguria (basic unit)" and "daytime (modifier) ​​+ oliguria (basic unit)" can be obtained.

[0063] In this embodiment, the most common first order in TCM clinical word order can include the following combinations: "condition modifier + basic unit", "time modifier + basic unit", "frequency modifier + basic unit", "basic unit + degree word", "condition modifier + degree word", "time modifier + degree word", "condition modifier + basic unit + degree word", and "time modifier + basic unit + degree word". The second order can include the following combinations: "basic unit + condition modifier", "basic unit + time modifier (e.g., the second order of oliguria (basic unit) + daytime (modifier)", "basic unit + frequency modifier (e.g., the second order of oliguria (basic unit) + frequent (modifier))", "degree word + basic unit", "basic unit + condition modifier + degree word", and "basic unit + time modifier + degree word".

[0064] Example 2 This embodiment proposes a TCM symptom segmentation device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the steps of the TCM symptom segmentation method described in Embodiment 1. Since the principle by which this TCM symptom segmentation device solves the problem is the same as the TCM symptom segmentation method in Embodiments 1 and 2 of this application, the implementation of this TCM symptom segmentation device can be found in [reference needed]. Figure 1 The flowchart shown will not be repeated for parts that are repeated.

[0065] like Figure 3 As shown, the TCM word segmentation device of this application embodiment includes: a processor 310, used to read the program in the memory 320 and execute the following processes: Obtain the symptom description text from the medical record; The medical record symptom description text is divided into multiple short sentences using any punctuation mark in the text as a separator, and the validity of each short sentence is verified to obtain valid short sentences; Based on a pre-built multi-level TCM dictionary system, each valid short sentence is segmented and labeled to obtain a sequence of morphemes with part-of-speech tags; Using the first combination rule, the morphemes in the part-of-speech-tagged morpheme sequence are combined to generate effective symptom combinations that conform to the expression habits of traditional Chinese medicine; The effective symptom combinations are processed using the second combination rule to obtain complete symptom terms; Based on a multi-level TCM dictionary system, complete symptom terms are merged and duplicated to obtain the final TCM symptom terms.

[0066] In this embodiment, the parts of speech tagged include: main words, subordinate words, adverbial words, modifiers, degree words, locative words, overall words, and feminine words; The multi-level TCM dictionary system includes: a symptom morpheme database, a high-dimensional TCM terminology attribute vector table, and a TCM outpatient medical record writing habit word order rule database; in the symptom morpheme database, each morpheme has been pre-labeled with a part of speech and has a unique ID, and is pre-bound to the corresponding attribute vector in the high-dimensional TCM terminology attribute vector table; the symptom morpheme database also stores the corresponding synonym morpheme variants of each morpheme.

[0067] The processor 310 reads the program from the memory 320 and also performs the following steps: The validity check for each short sentence includes: If any short sentence simultaneously satisfies the following conditions: it has only one valid part of speech or no valid part of speech, does not contain any valid whole words or valid single morphemes, and the part of speech it contains is not a combination of "modifier and degree word", then remove the punctuation mark that serves as the separator, merge the short sentence with the preceding short sentence next to it, and obtain a valid short sentence; otherwise, the short sentence is considered a valid short sentence. The effective parts of speech include main words, subordinate words, and adverbial words; the effective whole words are independent and indivisible complete TCM symptom terms; the effective morphemes are the smallest indivisible effective semantic morphemes with part-of-speech tags in the symptom morpheme library. The pre-built multi-level TCM dictionary system segments and annotates each valid short phrase, including: The forward maximum matching method is used to segment and label each valid phrase, resulting in a sequence of morphemes after segmentation of each valid phrase; Based on the part-of-speech tagging of each morpheme in the symptom morpheme library, the part-of-speech tagging of each morpheme in the morpheme sequence after each effective short sentence segmentation is used to obtain the part-of-speech tagged morpheme sequence.

[0068] The processor 310 reads the program from the memory 320 and also performs the following steps: The first combination rule is a sequential combination rule. Before assembling the part-of-speech-tagged morpheme sequence using the first combination rule, the process includes: Based on the morphemes in the part-of-speech tagged morpheme sequence, a current candidate combination is generated; the current candidate combination includes a four-part candidate combination, a three-part candidate combination, a two-part candidate combination, and a one-part candidate combination. The four-part candidate combination represents a candidate combination composed of four consecutive morphemes, the three-part candidate combination represents a candidate combination composed of three consecutive morphemes, the two-part candidate combination represents a candidate combination composed of two consecutive morphemes, and the one-part candidate combination represents a candidate combination composed of a single morpheme. The morphemes used to generate the current candidate combination will match and verify the current candidate combination with the symptom morpheme library according to the first matching verification priority. During the matching verification, the first matching verification priority is in the following order from high to low: first order of four-pair candidate combinations, second order of four-pair candidate combinations, first order of three-pair candidate combinations, second order of three-pair candidate combinations, first order of two-pair candidate combinations, second order of two-pair candidate combinations, and first order of one-pair candidate combinations. The first order is the order in which the parts of speech are most common in TCM clinical practice; the second order is the order in which special word orders are arranged with a lower frequency of commonity than the first order.

[0069] The step of combining morphemes in the part-of-speech-tagged sequence using the first combination rule includes: S41: Initialize scan pointer i; S42: Based on the symptom morpheme library, starting from the current scanning pointer i, according to the current candidate combination pointed to by the scanning pointer, the current candidate combination is matched and verified in descending order of the first matching verification priority. If the match is successful, the current candidate combination is taken as a valid symptom combination, and the scanning pointer i is moved backward to the position corresponding to the number of morphemes contained in the current candidate combination, and S34 is executed; otherwise, S33 is executed. S43: If the order of the first matching check priority corresponding to the current candidate combination is not the same as the order of the first matching check priority corresponding to the first-order candidate combination, switch to the next candidate combination in the current matching check priority sorting to obtain the new current candidate combination, and return to S32; if the order of the matching check priority corresponding to the current candidate combination is the same as the order of the first matching check priority corresponding to the first-order candidate combination, then the lexicon corresponding to the current candidate combination is an invalid redundant lexicon, discard it, move the scan pointer i backward to the position corresponding to the number of lexicons contained in the current candidate combination, and execute S34; S44: Check the remaining uncombined morphemes in the part-of-speech tagged morpheme sequence: If two or more morphemes with the same attribute are consecutively listed side by side, then the currently combined morpheme and the subsequent non-consecutive morphemes are concatenated across positions, and a matching verification is performed based on the symptom morpheme database. If the match is successful, the combination formed by concatenating the currently combined morpheme and the subsequent non-consecutive morphemes across positions is updated as a new valid symptom combination, and the scanning pointer position is adjusted; if the match fails, the valid symptom combination obtained in S42 is retained. If no parallel morphemes with the same attribute exist, execute S45; S45: If the position pointed to by the scanning pointer i exceeds the end of the part-of-speech morpheme sequence, output the valid symptom combination; otherwise, based on the morphemes in the part-of-speech morpheme sequence, generate the next current candidate combination and return to S42.

[0070] Optionally, the processor 310 reads the program from the memory 320 and also performs the following steps: The second combination rule is the clinical manifestation combination rule; multiple effective symptom combinations are used as basic units, and candidate unit combinations are generated based on the priority order of the part of speech of the units according to the clinical manifestation combination rule, and the remaining uncombined morphemes in the basic units and the part-of-speech-tagged morpheme sequence. The candidate unit combinations include four-unit candidate combinations, three-unit candidate combinations, two-unit candidate combinations, and one-unit candidate combinations. The four-unit candidate combination represents a candidate combination formed by splicing four consecutive basic units and the remaining uncombined morphemes in the part-of-speech-tagged morpheme sequence. The three-unit candidate combination represents a candidate combination formed by splicing three consecutive basic units and the remaining uncombined morphemes in the part-of-speech-tagged morpheme sequence. The two-unit candidate combination represents a candidate combination formed by splicing two consecutive basic units and the remaining uncombined morphemes in the part-of-speech-tagged morpheme sequence. The one-unit candidate combination represents a candidate combination formed by splicing a single basic unit and the remaining uncombined morphemes in the part-of-speech-tagged morpheme sequence. The candidate unit combinations are matched and verified with the TCM outpatient medical record writing habit word order rule library. During the matching and verification, the first matching and verification priority is the first order of four-unit candidate combinations, the second order of four-unit candidate combinations, the first order of three-unit candidate combinations, the second order of three-unit candidate combinations, the first order of two-unit candidate combinations, the second order of two-unit candidate combinations, and the first order of one-unit candidate combinations. The first order is the order in which the parts of speech are most common in TCM clinical practice; the second order is the order in which special word orders are arranged with a lower frequency of commonity than the first order.

[0071] The second combination rule is used to process the effective symptom combinations to obtain complete symptom terms, including: S51: Based on the basic unit and the morphemes in the morpheme sequence that are labeled as modifiers and degree words, an input sequence is formed, and the scan pointer i is initialized; S52: Based on the rule library of word order for writing habits in TCM outpatient medical records, starting from the current scanning pointer i, according to the candidate unit combination in the input sequence pointed to by the scanning pointer, the candidate unit combination is matched and verified in descending order of the first matching verification priority. If the match is successful, the candidate unit combination is used as a complete symptom term, and the scanning pointer i is moved backward to the position corresponding to the number of basic units contained in the candidate unit combination, and S54 is executed; otherwise, S53 is executed. S53: If the order of the first matching verification priority corresponding to the candidate unit combination is not the order of the first matching verification priority corresponding to the first-order unit candidate combination, switch to the next-order corresponding to the new candidate unit combination in the current matching verification priority sorting, obtain the new candidate unit combination, and return to S52; if the order of the matching verification priority corresponding to the candidate unit combination is the order of the first-order unit candidate combination in the first matching verification priority, then the candidate unit combination is invalid and discarded, and the scan pointer i is moved backward to the position corresponding to the number of basic units contained in the candidate unit combination, and S54 is executed; S54: If the position pointed to by the scan pointer i exceeds the end of the input sequence, output the complete symptom term; otherwise, based on the basic unit, generate the next candidate unit combination and return to S52.

[0072] If two or more morphemes of the same part of speech appear side by side in the input sequence, then cross-positional combination is performed across the side by side morphemes; For all successfully matched candidate unit combinations, uniform word ordering is performed, including: Check the positions of morphemes labeled as modifiers and degree words in the basic units and morpheme sequences of the candidate unit combinations; If a modifier or degree word appears after the base unit, move the modifier or degree word to the front of the base unit.

[0073] Among them, Figure 3 In this context, the bus architecture can include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 310 and memory represented by memory 320 together. The bus architecture can also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides the interface.

[0074] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the aforementioned TCM symptom segmentation method and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.

[0075] The embodiments described are merely examples to clearly illustrate the present invention and are not intended to limit the implementation of the invention. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively describe all possible implementations. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A method for segmenting TCM symptoms, characterized in that, Includes the following steps: Obtain the symptom description text from the medical record; The medical record symptom description text is divided into multiple short sentences using any punctuation mark in the text as a separator, and the validity of each short sentence is verified to obtain valid short sentences; Based on a pre-built multi-level TCM dictionary system, each valid short sentence is segmented and labeled to obtain a sequence of morphemes with part-of-speech tags; The multi-level TCM dictionary system includes: a symptom morpheme database, a high-dimensional TCM terminology attribute vector table, and a TCM outpatient medical record writing habit word order rule database; Using the first combination rule, the morphemes in the part-of-speech-tagged morpheme sequence are combined to generate effective symptom combinations that conform to the expression habits of traditional Chinese medicine; The first combination rule is a sequential combination rule, which generates the current candidate combination based on the morphemes in the morpheme sequence with part-of-speech tags. The morphemes used to generate the current candidate combination do not include morphemes in the morpheme sequence that are tagged as modifiers or degree words. The current candidate combination includes four-part candidate combinations, three-part candidate combinations, two-part candidate combinations, and one-part candidate combinations. The four-part candidate combination represents a candidate combination composed of four consecutive morphemes, the three-part candidate combination represents a candidate combination composed of three consecutive morphemes, the two-part candidate combination represents a candidate combination composed of two consecutive morphemes, and the one-part candidate combination represents a candidate combination composed of a single morpheme. The morphemes used to generate the current candidate combination will match and verify the current candidate combination with the symptom morpheme library according to the first matching verification priority. During the matching verification, the first matching verification priority is in the following order from high to low: first order of four-pair candidate combinations, second order of four-pair candidate combinations, first order of three-pair candidate combinations, second order of three-pair candidate combinations, first order of two-pair candidate combinations, second order of two-pair candidate combinations, and first order of one-pair candidate combinations. The step of combining morphemes in the part-of-speech-tagged sequence using the first combination rule includes: S41: Initialize scan pointer i; S42: Based on the symptom morpheme library, starting from the current scanning pointer i, according to the current candidate combination pointed to by the scanning pointer, the current candidate combination is matched and verified in descending order of the first matching verification priority. If the match is successful, the current candidate combination is taken as a valid symptom combination, and the scanning pointer i is moved backward to the position corresponding to the number of morphemes contained in the current candidate combination, and S44 is executed; otherwise, S43 is executed. S43: If the order of the first matching check priority corresponding to the current candidate combination is not the same as the order of the first matching check priority corresponding to the first-order candidate combination, switch to the next candidate combination in the current matching check priority sorting to obtain the new current candidate combination, and return to S42; if the order of the matching check priority corresponding to the current candidate combination is the same as the order of the first matching check priority corresponding to the first-order candidate combination, then the lexicon corresponding to the current candidate combination is an invalid redundant lexicon, discard it, move the scan pointer i backward to the position corresponding to the number of lexicons contained in the current candidate combination, and execute S44; S44: Check the remaining uncombined morphemes in the morpheme sequence: If two or more morphemes with the same attribute are consecutively listed side by side, then the currently combined morpheme and the subsequent non-consecutive morphemes are concatenated across positions, and a matching verification is performed based on the symptom morpheme database. If the match is successful, the combination formed by concatenating the currently combined morpheme and the subsequent non-consecutive morphemes across positions is updated as a new valid symptom combination, and the scanning pointer position is adjusted; if the match fails, the valid symptom combination obtained in S42 is retained. If no parallel morphemes with the same attribute exist, execute S45; S45: If the position pointed to by the scanning pointer i exceeds the end of the part-of-speech morpheme sequence, output the valid symptom combination; otherwise, based on the morphemes in the part-of-speech morpheme sequence, generate the next current candidate combination and return to S42; The effective symptom combinations are processed using the second combination rule to obtain complete symptom terms; Based on a multi-level TCM dictionary system, complete symptom terms are merged and duplicated to obtain the final TCM symptom terms.

2. The TCM symptom segmentation method according to claim 1, characterized in that, The parts of speech tagged include: main words, subordinate words, adverbs, modifiers, degree words, locative words, whole words, and feminine words; In the symptom morpheme library, each morpheme is pre-labeled with a part of speech and has a unique ID, and is pre-bound to the corresponding attribute vector of the high-dimensional TCM terminology attribute vector table; the symptom morpheme library also stores the corresponding synonym morpheme variants of each morpheme.

3. The TCM symptom segmentation method according to claim 2, characterized in that, The validity check for each short sentence includes: If any short sentence simultaneously satisfies the following conditions: it has only one valid part of speech or no valid part of speech, does not contain any valid whole words or valid single morphemes, and the part of speech it contains does not belong to the combination of "modifier and degree word", then remove the punctuation mark that serves as the separator, merge the short sentence with the adjacent preceding short sentence, and obtain a valid short sentence; otherwise, the short sentence is considered a valid short sentence. The effective parts of speech include main words, subordinate words, and adverbial words; the effective whole words are independent and indivisible complete TCM symptom terms; the effective morphemes are the smallest indivisible effective semantic morphemes with part-of-speech tags in the symptom morpheme library. The pre-built multi-level TCM dictionary system segments and annotates each valid short phrase, including: The forward maximum matching method is used to segment and label each valid phrase, resulting in a sequence of morphemes after segmentation of each valid phrase; Based on the part-of-speech tagging of each morpheme in the symptom morpheme library, the part-of-speech tagging of each morpheme in the morpheme sequence after each effective short sentence segmentation is performed. Based on the part-of-speech tagging of the morphemes, noise reduction processing is carried out to obtain the final morpheme sequence with part-of-speech tagging.

4. The TCM symptom segmentation method according to claim 3, characterized in that, The first order is the order in which the parts of speech in TCM clinical practice are most common; the second order is the order in which the parts of speech in TCM clinical practice are less common than the first order.

5. The TCM symptom segmentation method according to claim 1, characterized in that, The second combination rule is the clinical manifestation combination rule; multiple effective symptom combinations are used as basic units, and candidate unit combination sequences are generated based on the basic units and morphemes in the morpheme sequence that are labeled as modifiers and degree words; the candidate unit combination sequence includes multiple candidate unit combinations, including: modifier-basic unit combination, degree word-basic unit combination, modifier-basic unit-degree word combination, and modifier-degree word combination; the modifier-basic unit combination consists of two parts: modifier and basic unit, the degree word-basic unit combination consists of two parts: degree word and basic unit, the modifier-basic unit-degree word combination consists of three parts: modifier, basic unit, and degree word, and the modifier-degree word combination consists of two parts: modifier and degree word. Construct a second matching verification priority order, which includes: The more components a candidate unit combination has, the higher its priority. With the same number of components, the candidate unit combination that conforms to the first order has a higher priority than the current candidate combination that conforms to the second order. The first order is the order in which the parts of speech in TCM clinical practice are most common; the second order is the order in which the parts of speech in TCM clinical practice are less common than the first order.

6. The TCM symptom segmentation method according to claim 5, characterized in that, The second combination rule is used to process the effective symptom combinations to obtain complete symptom terms, including: S51: Based on the basic unit and the morphemes in the morpheme sequence that are labeled as modifiers and degree words, construct a candidate unit combination sequence. The candidate unit combination sequence includes multiple candidate unit combinations. The length of the candidate unit combination sequence is L, and initialize the scan pointer i to 0. S52: Determine whether the current candidate unit combination pointed to by the current scan pointer i belongs to the candidate unit combination sequence. If yes, execute S53; otherwise, execute S55. S53: Using the TCM outpatient medical record writing habit word order rule base, perform matching and verification on the current candidate unit combination. If the matching and verification is successful, the current candidate unit combination is used as a complete symptom term, the value of the current scan pointer i is increased by the number of components included in the current candidate unit combination, and S54 is executed; otherwise, S55 is executed. S54: If i is greater than or equal to L, terminate; if i is less than L, return to S52. S55: If the current candidate unit combination is not the lowest priority candidate unit combination in the second matching verification priority order, switch to the next priority candidate unit combination in the second matching verification priority order, generate a new current candidate unit combination, and return to execute S52; if the current candidate unit combination is the lowest priority candidate unit combination in the second matching verification priority order, the current candidate unit combination is invalid and redundant, discarded, the value of the scan pointer i is increased by the number of components included in the current candidate unit combination, and return to S54.

7. The TCM symptom segmentation method according to claim 6, characterized in that, If two or more morphemes of the same part of speech appear side by side in the candidate unit combination sequence, then cross-position combination is performed across the side by side morphemes; For all successfully matched candidate unit combinations, uniform word ordering is performed, including: Check the positions of morphemes labeled as modifiers and degree words in the basic unit and the morpheme sequence in the candidate unit combination. If a modifier or degree word appears after the basic unit, move the modifier or degree word to the front of the basic unit.

8. A TCM symptom segmentation device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the steps of the TCM symptom segmentation method according to any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the TCM symptom segmentation method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Chinese word segmentation method for traditional Chinese medicine symptom sentence

    CN107357780A

  • Traditional Chinese medicine ancient book word segmentation method and device, computer equipment and storage medium

    CN115310442A