Text sampling method, device, equipment and storage medium

By vectorizing the sampled corpus and performing stratified sampling using Gaussian kernel density estimation, the problem of Monte Carlo sampling ignoring the mid- and long-tail regions is solved, thereby improving the sample information content and the training effect of the pre-trained model.

CN117149942BActive Publication Date: 2025-09-19BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210556057.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-20
Publication Date
2025-09-19
Estimated Expiration
2042-05-20

AI Technical Summary

Technical Problem

In the existing technology, when sampling text data based on Monte Carlo sampling, samples are concentrated in the head area with high probability density, ignoring the middle and long tail areas with relatively low probability density, resulting in low sample information content and affecting the training effect of the pre-trained speech model.

Method used

By vectorizing the sampled corpus, determining the preset dimension vector set, and dividing the semantic space into multiple semantic subspaces based on Gaussian kernel density estimation, stratified sampling is performed, and the neighborhood sample set is determined and sampled to increase the amount of sample information.

Benefits of technology

Stratified sampling of the sampled corpus is achieved, which improves the information content and quality of the sampled samples and improves the training effect of the pre-trained language model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117149942B_ABST
    Figure CN117149942B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a text sampling method, apparatus, device and storage medium, the method comprising: determining a preset dimension vector set corresponding to the corpus to be sampled by vectorizing the corpus to be sampled; dividing the semantic space constituted by the preset dimension vector set into a first preset number of first semantic subspaces, and determining the sampling density within each first semantic subspace based on Gaussian kernel density estimation; dividing each first semantic subspace into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set within each second semantic subspace; sampling each neighborhood sample set, and determining a text sampling result based on the sampling results corresponding to all neighborhood sample sets. The above technical solution divides the semantic space corresponding to the corpus to be sampled into second semantic subspaces, determines the text sampling result based on the sampling results obtained by sampling in each second semantic subspace, and realizes stratified sampling of the corpus to be sampled.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Technology Neighborhood

[0002] The embodiments of the present invention relate to natural language processing technology, and in particular to a text sampling method, apparatus, device and storage medium. Background Art

[0003] In recent years, the rise of large-scale pre-trained language models has ushered in a new era of rapid development in natural language processing. Training pre-trained language models requires annotating the corpus. Manually annotating data is often expensive, and we aim to maximize the effectiveness of manual annotation—that is, to capture more information with the same number of annotations, or to minimize the number of annotations to achieve the same annotation effect.

[0004] In the prior art, text data is usually sampled using Monte Carlo sampling, ie, random sampling, which is essentially random sampling based on the probability density distribution of the data.

[0005] In the process of implementing the present invention, it was found that the prior art has at least the following technical problems:

[0006] The samples obtained by sampling text data based on Monte Carlo sampling are concentrated in the head area with high probability density, ignoring the middle and long tail areas with relatively low probability density, resulting in low sample information content, reduced labeling effect, and affecting the training of the pre-trained speech model. Summary of the Invention

[0007] The present invention provides a text sampling method, apparatus, device and storage medium to achieve adaptive stratified sampling of corpus and improve the information content of the samples obtained by sampling.

[0008] In a first aspect, an embodiment of the present invention provides a text sampling method, comprising:

[0009] Determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled;

[0010] Dividing the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determining a sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation;

[0011] Dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set within each of the second semantic subspaces;

[0012] Sampling is performed on each of the neighborhood sample sets, and a text sampling result is determined according to the sampling results corresponding to each of the neighborhood sample sets.

[0013] In a second aspect, an embodiment of the present invention further provides a text sampling device, comprising:

[0014] An encoding module, configured to determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled;

[0015] a first partitioning module, configured to divide the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determine a sampling density within each of the first semantic subspaces based on Gaussian kernel density estimation;

[0016] a second partitioning module, configured to partition each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determine a neighborhood sample set within each of the second semantic subspaces;

[0017] The sampling module is used to sample each of the neighborhood sample sets and determine the text sampling result according to the sampling results corresponding to each of the neighborhood sample sets.

[0018] In a third aspect, an embodiment of the present invention further provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the text sampling method as described in any one of the first aspects is implemented.

[0019] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer-executable instructions, wherein the computer-executable instructions, when executed by a computer processor, are used to perform the text sampling method as described in any one of the first aspects.

[0020] The embodiments of the above invention have the following advantages or beneficial effects:

[0021] An embodiment of the present invention provides a text sampling method, comprising: determining a preset dimensional vector set corresponding to the corpus to be sampled by vectorizing the corpus to be sampled; dividing the semantic space constituted by the preset dimensional vector set into a first preset number of first semantic subspaces, and determining the sampling density within each of the first semantic subspaces based on Gaussian kernel density estimation; dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set within each of the second semantic subspaces; sampling each of the neighborhood sample sets, and determining a text sampling result based on the sampling results corresponding to each of the neighborhood sample sets. The above technical solution can first perform vectorization processing on the sampled corpus to be represented based on a preset dimensional vector set. After dividing the semantic space constituted by the preset dimensional vector set into a first preset number of first semantic subspaces, the first semantic subspace is divided into a second preset number of second semantic subspaces according to the sampling density of the first semantic subspace. Neighborhood sample sets are determined in each second semantic subspace within each first semantic subspace, and sampling is performed on each neighborhood sample set to obtain sampling results. The text sampling results are determined based on the sampling results obtained by sampling in the neighborhood sample sets corresponding to each second semantic subspace, thereby realizing stratified sampling of the sampled corpus, increasing the amount of information of the samples obtained by sampling, and further improving the quality of text sampling. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A flowchart of a text sampling method provided by an embodiment of the present invention;

[0023] Figure 2 A flowchart of another text sampling method provided by an embodiment of the present invention;

[0024] Figure 3 A flowchart of step 240 in another text sampling method provided by an embodiment of the present invention;

[0025] Figure 4 A schematic diagram of dividing a three-dimensional semantic space in another text sampling method provided by an embodiment of the present invention;

[0026] Figure 5 A schematic diagram of dividing a three-dimensional first semantic subspace in another text sampling method provided by an embodiment of the present invention;

[0027] Figure 6 A schematic structural diagram of a text sampling device provided by an embodiment of the present invention;

[0028] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0029] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all structures.

[0030] It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processes or methods depicted as flow charts. Although flow charts describe various operations (or steps) as sequential processes, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. When its operation is completed, the process can be terminated, but can also have additional steps not included in the accompanying drawings. The process can correspond to methods, functions, procedures, subroutines, subprograms, etc. In addition, the features in the embodiments of the present invention and the embodiments can be combined with each other without conflict.

[0031] Supervised learning of pre-trained language models significantly outperforms unsupervised learning. However, the biggest challenge with supervised learning, especially deep learning, is the high cost of manual annotation of corpora. In practical applications, the distribution of large-scale text corpora exhibits a pronounced 80-20 long-tail pattern. For natural language processing, repeated annotation of semantically similar corpora in the head region is unnecessary. Instead, annotation of niche corpora in the long-tail region should be prioritized.

[0032] The text sampling results determined based on the corpus to be sampled and the annotation information corresponding to the text sampling results can be used as a training set to train the pre-trained language model. In order to improve the quality of the training set, the text sampling results obtained by text sampling the corpus to be sampled need to more completely cover the text features of the corpus to be sampled.

[0033] The following will combine the text sampling method described in the embodiment to specifically describe the process of sampling the expected sample to obtain the text sampling results. After the text sampling results are labeled, they can be used to train the pre-trained language model.

[0034] Figure 1 This is a flowchart of a text sampling method provided by an embodiment of the present invention. The embodiment of the present invention is applicable to situations where the quality of text sampling needs to be improved. The method can be executed by a text sampling device, which can be implemented by software and / or hardware. Figure 1 Said method specifically comprises the following steps:

[0035] Step 110: Determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled.

[0036] The corpus to be sampled can be obtained by removing noise from the original corpus extracted from the corpus database.

[0037] Specifically, vectorizing the sampled corpus can be performed as semantic encoding of the sampled corpus. Semantic encoding can process text through words, organize and summarize the text by meaning and systematic classification, identify the basic arguments, evidence, and logical structure of the text, and encode it according to semantic features to obtain a preset dimensional vector corresponding to the text. Therefore, based on the FastText model, semantic encoding of each text contained in the sampled corpus as a multidimensional dense vector can obtain a multidimensional dense vector set corresponding to the sampled corpus. The number of texts contained in the sampled corpus can determine the number of vectors contained in the multidimensional dense vector set.

[0038] In practical applications, to make the multidimensional dense vector set contain more text information, the FastText model can be used to semantically encode each text contained in the sampled corpus as a high-dimensional dense vector, thereby obtaining a high-dimensional dense vector set corresponding to the sampled corpus. The high-dimensional curse is easily generated during the processing of high-dimensional dense vector sets. Therefore, dimensionality reduction can be performed on the high-dimensional dense vector set to reduce the dimensionality of the high-dimensional dense vector set to a vector of a preset dimension.

[0039] In an embodiment of the present invention, vectorization processing of the sampled corpus is achieved by semantically encoding the sampled corpus, and a multi-dimensional dense vector can be obtained. In order to reduce the occurrence of high-dimensional disasters, the multi-dimensional dense vector can be reduced in dimensionality to obtain a preset dimensional vector set, which contains more text information without causing high-dimensional disasters.

[0040] Step 120: Divide the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determine the sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation.

[0041] The first semantic subspace may be a block, and the first preset number may be obtained by rounding up the square root of the number of sampled samples.

[0042] The preset dimensional vectors corresponding to all texts included in the sampled corpus can form a preset dimensional vector set. Therefore, a point in the semantic space formed by the preset dimensional vector set can represent a preset dimensional vector corresponding to a text included in the sampled corpus. Furthermore, sampling is performed in the semantic space to obtain a point in the semantic space. The text corresponding to the preset dimensional vector corresponding to the point can be determined as the text sampling result.

[0043] Specifically, the semantic space can be first divided into a first preset number of first semantic subspaces, and then the density of points in the semantic space can be determined based on Gaussian kernel density estimation. The density of points can indicate the distribution of the text, that is, the distribution density of the text, and then the sampling density in each first semantic subspace can be determined. The sampling density corresponding to the first semantic subspace can be used to determine the number of samples that need to be sampled in the first semantic subspace.

[0044] In an embodiment of the present invention, the semantic space constituted by the preset dimensional vector can be divided into a first preset number of first semantic subspaces, and the sampling density of each first semantic subspace can be determined, and then the number of samples that need to be sampled in the first semantic subspace can be determined based on the sampling density, so as to facilitate text sampling of a certain number of samples in each first semantic subspace in the semantic space, thereby realizing stratified sampling in the corpus to be sampled, so as to obtain a text sampling result with more uniform distribution and better quality.

[0045] Step 130 : Divide each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determine a neighborhood sample set in each of the second semantic subspaces.

[0046] The second semantic subspace may be a cell, and the second preset number may be the number of samples in each first semantic subspace.

[0047] Specifically, for a first semantic subspace with a sampling density less than or equal to 1, the number of samples that need to be sampled in the first semantic subspace is 1; for a first semantic subspace with a sampling density greater than 1, the number of samples that need to be sampled in the first semantic subspace is greater than 1. When the number of samples that need to be sampled is greater than 1, each first semantic subspace can be divided into a second semantic subspace with a corresponding number of samples based on the sampling density, and a sample can be determined in each second semantic subspace to achieve text sampling of the first semantic subspace; of course, when the number of samples that need to be sampled is less than or equal to 1, each first semantic subspace can also be divided into a second semantic subspace based on the sampling density, and a sample can be determined in the second semantic subspace to achieve text sampling of the first semantic subspace.

[0048] When determining samples in the second semantic subspace, all points in the second semantic subspace may be searched first, and a neighborhood sample set may be determined based on the text corresponding to the preset dimensional vector corresponding to the points meeting the requirements.

[0049] In an embodiment of the present invention, after the semantic space is divided into a first semantic subspace, the first semantic subspace can be divided into a second semantic subspace based on the number of samples that need to be sampled in the first semantic subspace, and the neighborhood sample set corresponding to the second semantic subspace is determined based on the neighborhood search in each second semantic subspace. Each neighborhood sample set can correspond to a sampling result respectively, thereby ensuring the randomness of sampling in the second semantic subspace.

[0050] Step 140: Sampling each of the neighborhood sample sets, and determining a text sampling result based on the sampling results corresponding to each of the neighborhood sample sets.

[0051] Specifically, after determining a neighborhood sample set within the second semantic subspace, unique sampling can be performed within the neighborhood sample set to determine a sampling result within the second semantic subspace. The sampling results within each second semantic subspace contained in the first semantic subspace can correspond to the sampling result of the first semantic subspace, and the sampling results within each first semantic subspace contained in the semantic space can correspond to the sampling result of the corpus to be sampled. Furthermore, the text represented by the preset dimensional vector corresponding to the sampling result of the corpus to be sampled can be determined as the text sampling result.

[0052] In the embodiment of the present invention, determining a unique sampling result in the second semantic subspace ensures the randomness of the sampling result under the stratification principle.

[0053] The text sampling method provided by an embodiment of the present invention includes: determining a preset dimensional vector set corresponding to the corpus to be sampled by vectorizing the corpus to be sampled; dividing the semantic space constituted by the preset dimensional vector set into a first preset number of first semantic subspaces, and determining the sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation; dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set in each of the second semantic subspaces; sampling each of the neighborhood sample sets, and determining a text sampling result based on the sampling results corresponding to each of the neighborhood sample sets. The above technical solution can first perform vectorization processing on the sampled corpus to be represented based on a preset dimensional vector set, divide the semantic space constituted by the preset dimensional vector set into a first preset number of first semantic subspaces, and then divide the first semantic subspace into a second preset number of second semantic subspaces according to the sampling density of the first semantic subspace. In each second semantic subspace within each first semantic subspace, a neighborhood sample set is determined, and each neighborhood sample set is sampled to obtain a sampling result. The text sampling result is determined based on the sampling results obtained by sampling in the neighborhood sample sets corresponding to all second semantic subspaces, thereby realizing stratified sampling of the sampled corpus, improving the amount of information of the sampled samples, and further improving the quality of text sampling.

[0054] Figure 2 A flowchart of another text sampling method provided by an embodiment of the present invention, which is applicable to situations where the quality of text sampling needs to be improved. Based on the above embodiments, the embodiment of the present invention adds "obtaining original corpus from a corpus; performing corpus cleaning on the original corpus based on preset rules to obtain the corpus to be sampled" before determining the preset dimensional vector set corresponding to the corpus to be sampled by vectorizing the corpus to be sampled. While dividing the semantic space constituted by the preset dimensional vector set into a first preset number of first semantic subspaces, "determining the first semantic space position of each of the first semantic subspaces" is added. While dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, "determining the second semantic space position of the second semantic subspace" is added. After determining the preset dimensional vector set corresponding to the corpus to be sampled by vectorizing the corpus to be sampled, "storing the preset dimensional vector set in a tree model" is added. The explanations of the terms that are the same as or corresponding to the above embodiments are not repeated here. See Figure 2 , the text sampling method provided by the embodiment of the present invention includes:

[0055] Step 210: Obtain original corpus from the corpus; perform corpus cleaning on the original corpus based on preset rules to obtain the corpus to be sampled.

[0056] The corpus may be a text database, the original corpus stored in the corpus may be original corpus containing noise, and the preset rules may be used to remove the noise contained in the original corpus.

[0057] Specifically, a portion of text data can be extracted from the corpus as the original corpus, and the original corpus can be cleaned according to preset rules. Specifically, the preset rules can be used to remove noise such as blank lines, multiple spaces, multiple asterisks, and multiple consecutive reduplications in the original corpus.

[0058] In the embodiment of the present invention, information with low significance in the original corpus is removed by performing corpus cleaning on the original corpus.

[0059] Step 220: Determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled.

[0060] In one implementation, step 220 may specifically include:

[0061] Multidimensional semantic encoding is performed on the multiple texts contained in the corpus to be sampled to obtain a multidimensional dense vector set; based on the principal component analysis method, the multidimensional dense vector set is adaptively reduced in dimension to obtain the preset dimensional vector set, wherein the information loss when reducing the multidimensional dense vector set to the preset dimensional vector set does not exceed a preset threshold.

[0062] The preset threshold may be 30%.

[0063] Specifically, based on the FastText model, multidimensional semantic encoding can be performed on the multiple texts contained in the sampled corpus to obtain a multidimensional dense vector set corresponding to the sampled corpus, which is composed of the multidimensional dense vectors corresponding to each text. The number of texts contained in the sampled corpus can determine the number of vectors contained in the multidimensional dense vector set.

[0064] High-dimensional semantic encoding is the foundation of deep learning language models and is significantly superior to traditional sparse bag-of-words encoding in semantic representation. Therefore, the FastText model can be used to semantically encode each text entry in the sampled corpus using a high-dimensional dense vector, resulting in a high-dimensional dense vector set corresponding to the sampled corpus. The process of processing high-dimensional dense vector sets is prone to the curse of high dimensionality. Therefore, dimensionality reduction can be performed on the high-dimensional dense vector set based on principal component analysis to reduce the high-dimensional dense vector set to a preset dimensional vector set. The preset dimensional vector set can have a preset dimensionality between 3 and 10. Of course, after reducing the high-dimensional dense vector set to the preset dimensional vector set, the information retained in the preset dimensional vector set must be no less than 70% of the high-dimensional dense vector set, meaning that the information loss in the preset dimensional vector set must not exceed 30% of that in the 300-dimensional dense vector set.

[0065] Of course, reducing a multi-dimensional dense vector set to a preset dimension vector set can alleviate the memory overflow problem caused by an ultra-large-scale vector set.

[0066] In practical applications, the semantic encoding of the high-dimensional semantic dense vector can be the semantic encoding of a 300-dimensional dense vector, and the obtained high-dimensional dense vector set can be a 300-dimensional dense vector set. The preset dimension of the preset dimension vector set can be a dimension N between 3 and 10 dimensions, that is, after reducing the high-dimensional dense vector set to the preset dimension vector set,

[0067] Of course, the information retention of the 300-dimensional dense vector set can be determined based on the original data contained in the 300-dimensional dense vector set, and the information retention of the preset dimension vector set can be determined based on the dimensionality reduction data contained in the preset dimension vector set. Therefore, the proportion of the information retention of the preset dimension vector set in the information retention of the 300-dimensional dense vector set can be determined, and the preset dimension of the preset dimension vector set can be determined based on the proportion.

[0068] In an embodiment of the present invention, vectorization processing of the sampled corpus is achieved by semantically encoding the sampled corpus, and a 300-dimensional dense vector can be obtained. In order to reduce the occurrence of high-dimensional disasters, the 300-dimensional dense vector can be reduced in dimensionality to obtain an N-dimensional vector set. The N-dimensional vector set contains more text information without causing high-dimensional disasters.

[0069] Step 230: Store the preset dimension vector set in a tree model.

[0070] Specifically, the N-dimensional vector set can be indexed using a "space-for-time" strategy based on a kd tree algorithm or a ball tree algorithm to form a kd tree model or a ball tree model, and the tree model can be loaded into memory.

[0071] In the embodiment of the present invention, the N-dimensional vector set is stored in a tree model and loaded into a memory to facilitate indexing of the N-dimensional vector set.

[0072] Step 240: Divide the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determine the sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation.

[0073] Before dividing the semantic space, the boundary of the semantic space may be normalized so that the boundary of the semantic space is between [-1, 1].

[0074] Figure 3 A flowchart of step 240 in another text sampling method provided by an embodiment of the present invention is shown as follows: Figure 3 As shown, in one implementation, step 240 may specifically include:

[0075] Step 2410: Evenly divide each axis of the semantic space of the preset dimension formed by the preset dimensional vector set into P segments to obtain a first preset number of the first semantic subspaces, and simultaneously determine the first semantic space position of each of the first semantic subspaces.

[0076] Wherein, P is determined by the first preset number and the preset dimension of the preset dimension vector set.

[0077] In practical applications, after determining the 1 / 2 power of the number of sample samples, round it up to get the first preset number. The number of sample samples can be samp_num, so the first preset number Since the preset dimension of the preset dimension vector set is N, it can be determined that

[0078] Specifically, the N axes of the N-dimensional semantic space formed by the N-dimensional vector set can be evenly divided into P segments, thereby dividing the semantic space into M first semantic subspaces. While dividing the semantic space into M first semantic subspaces, the first semantic space position of each first semantic subspace can be determined.

[0079] For example, the preset dimension of the preset dimensional vector set may be 3, and the three-dimensional vector set may constitute a three-dimensional semantic space. Figure 4 A schematic diagram of dividing a three-dimensional semantic space in another text sampling method provided by an embodiment of the present invention, such as Figure 4 As shown, by dividing the three axes of the three-dimensional semantic space into P segments, M first semantic subspaces can be obtained.

[0080] In practical applications, the first semantic space position of the first semantic subspace can indicate the uniquely determined position of the first semantic subspace in the semantic space. For example, the center position of the first semantic subspace can be determined as the first semantic space position of the first semantic subspace. Since the length, width, and height of the first semantic subspace can be determined during the process of dividing the semantic space into the first semantic subspace, once the center position of the first semantic subspace is determined, the first semantic subspace can be uniquely determined in the semantic space.

[0081] Step 2420: Perform Gaussian kernel density estimation modeling on the semantic space to determine the Gaussian kernel density model corresponding to the semantic space.

[0082] Among them, the Gaussian kernel density model can indicate the density of points in the semantic space. The points in the semantic space represent N-dimensional vectors, and the N-dimensional vectors can represent the text in the corpus to be sampled. Therefore, each point in the semantic space can represent each text in the corpus to be sampled.

[0083] Specifically, Gaussian kernel density modeling may be performed on the semantic space to determine a Gaussian kernel density model corresponding to the semantic space. The Gaussian kernel density model may include the density of points in the semantic space.

[0084] Step 2430: In the Gaussian kernel density model, determine the number of samples in each of the first semantic subspaces according to the number of sampling samples and the first semantic space position of each of the first semantic subspaces.

[0085] Specifically, the first semantic subspace can be uniquely determined in the semantic space based on its first semantic spatial position, and furthermore, the first semantic subspace can be uniquely determined in a Gaussian kernel density model. Furthermore, the density of points in the first semantic subspace can be determined in the Gaussian kernel density model. When the number of sampled samples is known, the number of samples in the first semantic subspace can be determined based on the number of sampled samples and the density of points in the first semantic subspace.

[0086] For example, the number of sampling samples is samp_num, and the density of points in the first semantic subspace is 1 / 10. Therefore, it can be determined that the number of samples in the first semantic subspace is samp_num / 10.

[0087] Step 2440: Determine the sample size as the sampling density.

[0088] Specifically, the number of samples in the first semantic subspace may be determined as the sampling density of the first semantic subspace, and density sampling may be performed in the first semantic subspace based on the sampling density.

[0089] The significance of density sampling is to sample more samples in the head area where the data probability density is high, and sample at least one sample in the tail area where the data probability density is low, thereby ensuring the diversity of the sampling results and realizing stratified sampling.

[0090] In an embodiment of the present invention, the semantic space constituted by the preset dimensional vector is divided into a first preset number of first semantic subspaces according to the number of sampling samples, and after Gaussian kernel density modeling is performed on the semantic space, the number of samples that need to be sampled in each first semantic subspace is determined based on the density of the points in the Gaussian kernel density model, and the number of samples is determined as the sampling density corresponding to the first semantic subspace, so as to facilitate density sampling based on the sampling density in each first semantic subspace, thereby realizing stratified sampling in the corpus to be sampled, so as to obtain a text sampling result with more uniform distribution and better quality.

[0091] Step 250: Divide each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determine a neighborhood sample set in each of the second semantic subspaces.

[0092] In one implementation, step 250 may specifically include:

[0093] Each axis of each first semantic subspace is evenly divided into Q segments to obtain the second preset number of second semantic subspaces, and at the same time, the second semantic space position of the second semantic subspace is determined, where Q is determined by the number of samples in each first semantic subspace; a neighborhood search is performed in each second semantic subspace to determine the neighborhood sample set in each second semantic subspace.

[0094] In practical applications, after determining the 1 / N power of the number of samples corresponding to each first semantic subspace, the number is rounded up to obtain a second preset number corresponding to the first semantic subspace, where N is a preset dimension.

[0095] As mentioned above, when the number of samples corresponding to the first semantic subspace is samp_num / 10, the second preset number corresponding to the first semantic subspace can be determined.

[0096] Specifically, based on the aforementioned idea of ​​dividing the semantic space into M first semantic subspaces, each first semantic subspace can be divided into samp_num / 10 second semantic subspaces. Specifically, the N axes of the first semantic subspace in the N-dimensional semantic space can be evenly divided into Q segments, thereby dividing the first semantic subspace into samp_num / 10 second semantic subspaces. While dividing the first semantic subspace into samp_num / 10 second semantic subspaces, the second semantic space position of each second semantic subspace can be determined.

[0097] Likewise, the preset dimension of the preset dimension vector set may be 3. Figure 5 A schematic diagram of dividing the three-dimensional first semantic subspace in another text sampling method provided by an embodiment of the present invention, such as Figure 5 As shown, the three axes of the three-dimensional first semantic subspace are divided into Q segments, and samp_num / 10 second semantic subspaces can be obtained.

[0098] In practical applications, the second semantic space position of the second semantic subspace can indicate the uniquely determined position of the second semantic subspace in the semantic space. For example, the center position of the second semantic subspace can be determined as the second semantic space position of the second semantic subspace. Since the first semantic space to which the second semantic subspace belongs is known, the length, width, and height of the first semantic subspace can be determined during the process of dividing the semantic space into the first semantic subspace, and the length, width, and height of the second semantic subspace can be determined during the process of dividing the first semantic subspace into the second semantic subspace. Therefore, after determining the center position of the second semantic subspace, the second semantic subspace can be uniquely determined in the semantic space.

[0099] In one embodiment, performing a neighborhood search in each of the second semantic subspaces to determine a neighborhood sample set in each of the second semantic subspaces includes:

[0100] The center point coordinates of the second semantic subspace are determined according to the second semantic space position of the second semantic subspace; with the center point coordinates as the center of the sphere and the diagonal of the second semantic subspace as the diameter, a neighborhood search of the circumscribed sphere of the second semantic subspace is performed based on the tree model to obtain the neighborhood sample set.

[0101] Among them, the tree model stores all preset dimension vector sets.

[0102] Specifically, the second semantic space of the second semantic subspace can be the coordinates of the center point of the second semantic subspace. In the process of dividing the first semantic subspace into the second semantic subspace, the length, width and height of the second semantic subspace can be determined. Therefore, the diagonal of the second semantic subspace can be determined. With the coordinates of the center point of the second semantic subspace as the center of the sphere and the diagonal of the second semantic subspace as the diameter, the circumscribed sphere of the second semantic subspace can be determined. A neighborhood search is performed within the circumscribed sphere of the second semantic subspace. Specifically, a neighborhood search can be performed within the circumscribed sphere of the second semantic subspace based on a tree model, and the search results are determined as a neighborhood sample set S = {s1, s2, ...}. Performing a neighborhood search within the circumscribed sphere of the second semantic subspace based on a tree model speeds up the determination of the neighborhood sample set and further improves the sampling efficiency.

[0103] It should be noted that the diagonal of the second semantic subspace Here, cell_size represents the side length of the second semantic subspace in a certain dimension.

[0104] In an embodiment of the present invention, after the semantic space is divided into a first semantic subspace, the first semantic subspace can be divided into a second semantic subspace based on the number of samples that need to be sampled in the first semantic subspace, and the neighborhood sample set corresponding to the second semantic subspace is determined based on the neighborhood search in each second semantic subspace. Each neighborhood sample set can correspond to a sampling result, thereby ensuring the randomness of sampling in the second semantic subspace.

[0105] Step 260: Sampling each of the neighborhood sample sets, and determining a text sampling result based on the sampling results corresponding to each of the neighborhood sample sets.

[0106] Specifically, a non-repeated random sampling of a sample can be performed on the neighborhood sample set S = {s1, s2, ...} to obtain the sampling result s corresponding to the neighborhood sample set i , random sampling ensures the randomness of sampling under the stratification principle.

[0107] Similarly, the sampling results within each second semantic subspace contained in the first semantic subspace can correspond to the sampling results of the first semantic subspace, and the sampling results within each first semantic subspace contained in the semantic space can correspond to the sampling results of the corpus to be sampled. Furthermore, the sampling results within all second semantic subspaces contained in the first semantic subspace can be determined as the sampling results corresponding to the first semantic subspace, and the sampling results within all first semantic subspaces contained in the semantic space can be determined as the sampling results corresponding to the semantic space, that is, the sampling results of the corpus to be sampled. Further, the text represented by the preset dimension vector corresponding to the sampling results of the corpus to be sampled can be determined as the text sampling result.

[0108] In the embodiment of the present invention, determining a unique sampling result in the second semantic subspace ensures the randomness of the sampling result under the stratification principle.

[0109] The text sampling method provided by an embodiment of the present invention includes: obtaining original corpus from a corpus; performing corpus cleaning on the original corpus based on preset rules to obtain the corpus to be sampled; determining a preset dimension vector set corresponding to the corpus to be sampled by vectorizing the corpus to be sampled; storing the preset dimension vector set in a tree model; dividing the semantic space constituted by the preset dimension vector set into a first preset number of first semantic subspaces, and determining the sampling density within each of the first semantic subspaces based on Gaussian kernel density estimation; dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set within each of the second semantic subspaces; sampling each of the neighborhood sample sets, and determining a text sampling result based on the sampling results corresponding to each of the neighborhood sample sets. The above technical solution can first perform corpus cleaning on the original corpus obtained from the corpus to obtain the corpus to be sampled, and then perform vectorization processing on the corpus to be sampled to represent the corpus to be sampled based on a preset dimensional vector set, thereby solving the high-dimensional disaster and alleviating the memory overflow problem. At the same time, the preset dimensional vector set can be stored in a tree model. After the semantic space formed by the preset dimensional vector set is divided into a first preset number of first semantic subspaces, the first semantic subspace is divided into a second preset number of second semantic subspaces according to the sampling density of the first semantic subspace. A neighborhood search is performed within the circumscribed sphere of the second semantic subspace based on the tree model to determine a neighborhood sample set in each second semantic subspace within each first semantic subspace, thereby improving the speed of determining the neighborhood sample set. Each neighborhood sample set is sampled to obtain a sampling result, and the text sampling result is determined based on the sampling results obtained by sampling in the neighborhood sample sets corresponding to all second semantic subspaces, thereby realizing stratified sampling of the sampled corpus, improving the information content of the sampled samples, and further improving the quality of text sampling.

[0110] In practical applications, the text sampling results can be annotated, and the text sampling results and the annotation information corresponding to the text sampling results can be used as a training set to train the pre-trained language model. Since the training set composed of the text sampling results and the annotation information corresponding to the text sampling results meets the adaptive stratified sampling with a long-tail area tilt, the sampling quality is relatively high. The improvement in sampling quality is exchanged for a significant reduction in the number of annotated samples. More importantly, the adaptive stratification characteristics of the sampling can improve the generalization ability of the model.

[0111] Figure 6This is a structural diagram of a text sampling device provided in an embodiment of the present invention. The device and the text sampling methods of the above-mentioned embodiments belong to the same inventive concept. For details not fully described in the embodiments of the text sampling device, please refer to the embodiments of the above-mentioned text sampling method.

[0112] The specific structure of the text sampling device is as follows: Figure 6 Shown, including:

[0113] An encoding module 610 is configured to determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled;

[0114] A first partitioning module 620 is configured to partition the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determine a sampling density within each of the first semantic subspaces based on Gaussian kernel density estimation;

[0115] A second division module 630 is configured to divide each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determine a neighborhood sample set within each of the second semantic subspaces;

[0116] The sampling module 640 is configured to sample each of the neighborhood sample sets and determine a text sampling result based on the sampling results corresponding to each of the neighborhood sample sets.

[0117] Based on the above embodiment, the encoding module 610 is specifically configured to:

[0118] Performing multidimensional semantic coding on the plurality of texts contained in the corpus to be sampled to obtain a multidimensional dense vector set;

[0119] Adaptive dimensionality reduction is performed on the multidimensional dense vector set based on principal component analysis to obtain the preset dimensionality vector set, wherein the information loss amount of reducing the multidimensional dense vector set to the preset dimensionality vector set does not exceed a preset threshold.

[0120] Based on the above embodiment, the device further includes:

[0121] The cleaning module is used to obtain original corpus from the corpus; and perform corpus cleaning on the original corpus based on preset rules to obtain the corpus to be sampled.

[0122] Based on the above embodiment, the first division module 620 is specifically configured to:

[0123] Evenly dividing each axis of the semantic space of the preset dimension constituted by the preset dimensional vector set into P segments to obtain a first preset number of the first semantic subspaces, and simultaneously determining a first semantic space position of each of the first semantic subspaces, wherein P is determined by the first preset number and the preset dimension of the preset dimensional vector set;

[0124] Performing Gaussian kernel density estimation modeling on the semantic space to determine a Gaussian kernel density model corresponding to the semantic space;

[0125] In the Gaussian kernel density model, determining the number of samples in each of the first semantic subspaces according to the number of sampling samples and the first semantic space position of each of the first semantic subspaces;

[0126] The sample size is determined as the sampling density.

[0127] Based on the above embodiment, the second division module 630 is specifically configured to:

[0128] Evenly dividing each axis of each first semantic subspace into Q segments to obtain a second preset number of second semantic subspaces, and determining a second semantic space position of the second semantic subspace, wherein Q is determined by the number of samples in each first semantic subspace;

[0129] A neighborhood search is performed in each of the second semantic subspaces to determine the neighborhood sample set in each of the second semantic subspaces.

[0130] Based on the above embodiment, the device further includes:

[0131] A storage module, configured to store the preset dimension vector set in a tree model;

[0132] Accordingly, the second dividing module 630 is further configured to:

[0133] determining the coordinates of a center point of the second semantic subspace according to the second semantic space position of the second semantic subspace;

[0134] Taking the coordinates of the center point as the center of the sphere and the diagonal of the second semantic subspace as the diameter, a neighborhood search of the circumscribed sphere of the second semantic subspace is performed based on the tree model to obtain the neighborhood sample set.

[0135] Based on the above embodiment, the device further includes:

[0136] A first quantity determination module, configured to determine the 1 / 2 power of the number of sampled samples and round it up to obtain the first preset quantity;

[0137] The second quantity determination module is used to determine the 1 / N power of the number of samples corresponding to each first semantic subspace, and then round up to obtain the second preset number corresponding to the first semantic subspace, where N is the preset dimension.

[0138] The text sampling device provided in the embodiment of the present invention can execute the text sampling method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the text sampling method.

[0139] It is worth noting that in the embodiment of the above-mentioned text sampling device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the various functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0140] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. Figure 7 A block diagram of an exemplary electronic device 7 suitable for implementing embodiments of the present invention is shown. Figure 7 The electronic device 7 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0141] like Figure 7 As shown, the electronic device 7 is in the form of a general-purpose computing electronic device. Components of the electronic device 7 may include, but are not limited to, one or more processors or processing units 16, a system memory 28, and a bus 18 connecting various system components (including the system memory 28 and the processing unit 16).

[0142] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. Examples of these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0143] The electronic device 7 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 7, including volatile and non-volatile media, removable and non-removable media.

[0144] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 7 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be configured to read and write non-removable, non-volatile magnetic media ( Figure 7 Not shown, often called a "hard drive"). Although Figure 7 Not shown, a magnetic disk drive for reading and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of various embodiments of the present invention.

[0145] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0146] The electronic device 7 may also communicate with one or more external devices 14 (e.g., a keyboard, a pointing device, a display 24, etc.), one or more devices that enable a user to interact with the electronic device 7, and / or any device that enables the electronic device 7 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 7 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. Figure 7 As shown, the network adapter 20 communicates with other modules of the electronic device 7 via the bus 18. Figure 7 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 7, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0147] The processing unit 16 executes various functional applications and page displays by running programs stored in the system memory 28, for example, implementing the text sampling method provided by the embodiment of the present invention, which includes:

[0148] Determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled;

[0149] Dividing the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determining a sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation;

[0150] Dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set within each of the second semantic subspaces;

[0151] Sampling is performed on each of the neighborhood sample sets, and a text sampling result is determined according to the sampling results corresponding to each of the neighborhood sample sets.

[0152] Of course, those skilled in the art will appreciate that the processor may also implement the technical solution of the text sampling method provided in any embodiment of the present invention.

[0153] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the text sampling method provided in the embodiment of the present invention is implemented, for example, and the method includes:

[0154] Determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled;

[0155] Dividing the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determining a sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation;

[0156] Dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set within each of the second semantic subspaces;

[0157] Sampling is performed on each of the neighborhood sample sets, and a text sampling result is determined according to the sampling results corresponding to each of the neighborhood sample sets.

[0158] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.

[0159] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0160] Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0161] Computer program code for performing the operations of the present invention may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0162] Those skilled in the art will appreciate that the modules or steps of the present invention described above can be implemented using a general-purpose computing device. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Alternatively, they can be implemented using program code executable by a computer device, which can then be stored in a storage device and executed by the computing device. Alternatively, they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.

[0163] In addition, the acquisition, storage, use, and processing of data in the technical solution of the present invention comply with the relevant provisions of national laws and regulations.

[0164] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will appreciate that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions are possible for those skilled in the art without departing from the scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the scope of the present invention. The scope of the present invention is determined by the scope of the appended claims.

Claims

1. A text sampling method, characterized in that: include: Determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled; Dividing the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determining a sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation; Dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set within each of the second semantic subspaces; Sampling is performed on each of the neighborhood sample sets, and a text sampling result is determined according to the sampling results corresponding to each of the neighborhood sample sets.

2. The text sampling method according to claim 1, characterized in that Determining a preset dimension vector set corresponding to the corpus to be sampled by vectorizing the corpus to be sampled includes: Performing multidimensional semantic coding on the plurality of texts contained in the corpus to be sampled to obtain a multidimensional dense vector set; Adaptive dimensionality reduction is performed on the multidimensional dense vector set based on principal component analysis to obtain the preset dimensionality vector set, wherein the information loss amount of reducing the multidimensional dense vector set to the preset dimensionality vector set does not exceed a preset threshold.

3. The text sampling method according to claim 1, characterized in that Before vectorizing the sampled corpus, it also includes: Get the original data from the corpus; The original corpus is cleaned based on preset rules to obtain the corpus to be sampled.

4. The text sampling method according to claim 1, characterized in that Dividing the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces includes: Each axis of the semantic space of the preset dimension formed by the preset dimensional vector set is evenly divided into P segments to obtain a first preset number of the first semantic subspaces, where P is determined by the first preset number and the preset dimension of the preset dimensional vector set.

5. The text sampling method according to claim 1, characterized in that: When dividing the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, the method further includes: A first semantic space position of each of the first semantic subspaces is determined.

6. The text sampling method according to claim 5, characterized in that: Determining a sampling density in each of the first semantic subspaces based on Gaussian kernel density estimation includes: Performing Gaussian kernel density estimation modeling on the semantic space to determine a Gaussian kernel density model corresponding to the semantic space; In the Gaussian kernel density model, determining the number of samples in each of the first semantic subspaces according to the number of sampling samples and the first semantic space position of each of the first semantic subspaces; The sample size is determined as the sampling density.

7. The text sampling method according to claim 6, characterized in that: Dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determining a neighborhood sample set in each of the second semantic subspaces, including: Evenly dividing each axis of each first semantic subspace into Q segments to obtain a second preset number of second semantic subspaces, wherein Q is determined by the number of samples in each first semantic subspace; A neighborhood search is performed in each of the second semantic subspaces to determine the neighborhood sample set in each of the second semantic subspaces.

8. The text sampling method according to claim 7, characterized in that: When each of the first semantic subspaces is divided into a second preset number of second semantic subspaces according to the sampling density, the method further includes: A second semantic space position of the second semantic subspace is determined.

9. The text sampling method according to claim 8, characterized in that: After determining a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled, the method further includes: Storing the preset dimension vector set in a tree model; Accordingly, performing a neighborhood search in each of the second semantic subspaces to determine the neighborhood sample set in each of the second semantic subspaces includes: determining the coordinates of a center point of the second semantic subspace according to the second semantic space position of the second semantic subspace; Taking the coordinates of the center point as the center of the sphere and the diagonal of the second semantic subspace as the diameter, a neighborhood search of the circumscribed sphere of the second semantic subspace is performed based on the tree model to obtain the neighborhood sample set.

10. The text sampling method according to claim 6, characterized in that: Before dividing the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, the method further includes: After determining the 1 / 2 power of the number of sampled samples, rounding it up to obtain the first preset number; Accordingly, before dividing each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, the method further includes: After determining the 1 / Nth power of the number of samples corresponding to each first semantic subspace, rounding up is performed to obtain the second preset number corresponding to the first semantic subspace, where N is the preset dimension.

11. A text sampling device, characterized in that: include: An encoding module, configured to determine a preset dimension vector set corresponding to the corpus to be sampled by performing vectorization processing on the corpus to be sampled; a first partitioning module, configured to divide the semantic space formed by the preset dimensional vector set into a first preset number of first semantic subspaces, and determine a sampling density within each of the first semantic subspaces based on Gaussian kernel density estimation; a second partitioning module, configured to partition each of the first semantic subspaces into a second preset number of second semantic subspaces according to the sampling density, and determine a neighborhood sample set within each of the second semantic subspaces; The sampling module is used to sample each of the neighborhood sample sets and determine the text sampling result according to the sampling results corresponding to each of the neighborhood sample sets.

12. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the text sampling method according to any one of claims 1 to 10 is implemented.

13. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the text sampling method according to any one of claims 1 to 10 when executed by a computer processor.

Citation Information

Patent Citations

  • Density semantic sub-space-based no-label identification method for texts and images

    CN107341522A

  • Corpus data sampling method and system based on adjacency density

    CN112256823A