A method, apparatus, device, and storage medium for generating word clouds.

CN116384334BActive Publication Date: 2026-08-14BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-09
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

目前的检测方法复杂度较高,计算量较大,难以满足检测的需要

Benefits of technology

[0020] This application provides a method, apparatus, device, and storage medium for generating word clouds. It involves acquiring multiple texts to be arranged and generating text arrangement lines in a canvas area; then, based on these lines, determining the positions of the texts to be arranged sequentially to obtain a word cloud. The grids occupied by adjacent texts to be arranged do not overlap. The grids, obtained by dividing the canvas area, can detect whether the texts to be arranged collide. The grid granularity is relatively large, with each grid containing multiple pixels. Detecting collisions of texts based on the grid has low complexity, simplifying the computational burden of generating the word cloud.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116384334B_ABST
    Figure CN116384334B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and storage medium for generating word clouds. These methods, apparatus, device, and storage medium are applicable to the field of data processing. They involve acquiring multiple texts to be arranged and generating text arrangement lines in a canvas area; then, based on these text arrangement lines, determining the positions of the texts to be arranged sequentially to obtain a word cloud. The grids occupied by adjacent texts to be arranged do not overlap. The grids obtained based on the canvas area division can detect whether the texts to be arranged collide. The grid granularity is relatively large, with each grid including multiple pixels. Detecting collisions of texts to be arranged based on the grid has low complexity, simplifying the computational burden of generating the word cloud and solving the problem of high complexity and computational burden in current methods for detecting text overlap in word clouds.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, specifically to a method, apparatus, device, and storage medium for generating word clouds. Background Technology

[0002] A word cloud is a chart tool used to visually represent frequently occurring keywords in text. As a relatively new charting tool, word clouds can visually highlight keywords in text, resulting in better communication.

[0003] During the generation of word clouds, it is necessary to detect whether each word collides with other words, i.e., whether they overlap. Current detection methods are highly complex and computationally intensive, making them difficult to meet the detection requirements. Summary of the Invention

[0004] In view of this, this application provides a method, apparatus, device and storage medium for generating word cloud diagrams, which can reduce the complexity of the word cloud diagram generation process and reduce the amount of computation.

[0005] To solve the above problems, the technical solution provided in this application is as follows:

[0006] In a first aspect, embodiments of this application provide a method for generating a word cloud, the method comprising:

[0007] Obtain at least two texts to be displayed;

[0008] Generate text placement lines within the canvas area; the text placement lines are used to determine the position where the text to be placed will be positioned.

[0009] According to the text placement line, the position of the text to be placed is determined to obtain a word cloud. The grids occupied by the adjacent texts to be placed do not overlap with each other. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels.

[0010] Secondly, embodiments of this application provide a word cloud generation apparatus, the apparatus comprising:

[0011] The acquisition unit is used to acquire at least two texts to be displayed.

[0012] A generation unit is used to generate text placement lines within a canvas area, the text placement lines being used to determine the position where the text to be placed is located;

[0013] The determining unit is used to determine the position of the text to be placed according to the text placement line to obtain a word cloud. The grids occupied by the adjacent texts to be placed do not overlap with each other. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels.

[0014] Thirdly, embodiments of this application provide an electronic device, including:

[0015] One or more processors;

[0016] Storage device, on which one or more programs are stored,

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the word cloud generation method as described in the first aspect.

[0018] Fourthly, embodiments of this application provide a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the word cloud generation method as described in the first aspect.

[0019] Therefore, this application has the following beneficial effects:

[0020] This application provides a method, apparatus, device, and storage medium for generating word clouds. It involves acquiring multiple texts to be arranged and generating text arrangement lines in a canvas area; then, based on these lines, determining the positions of the texts to be arranged sequentially to obtain a word cloud. The grids occupied by adjacent texts to be arranged do not overlap. The grids, obtained by dividing the canvas area, can detect whether the texts to be arranged collide. The grid granularity is relatively large, with each grid containing multiple pixels. Detecting collisions of texts based on the grid has low complexity, simplifying the computational burden of generating the word cloud. Attached Figure Description

[0021] Figure 1 A schematic diagram illustrating an exemplary application scenario provided in the embodiments of this application;

[0022] Figure 2 A flowchart illustrating a method for generating a word cloud image as provided in this application embodiment;

[0023] Figure 3 A schematic diagram of a text emission line provided in an embodiment of this application;

[0024] Figure 4 A schematic diagram of another text emission line provided in an embodiment of this application;

[0025] Figure 5 A schematic diagram of a text emission line provided in an embodiment of this application;

[0026] Figure 6 A schematic diagram of a grid provided for an embodiment of this application;

[0027] Figure 7 A schematic diagram of another grid provided in an embodiment of this application;

[0028] Figure 8 A schematic diagram of a bounding matrix of text to be displayed, provided for an embodiment of this application;

[0029] Figure 9 A flowchart illustrating a method for generating a word cloud image as provided in this application embodiment;

[0030] Figure 10a A schematic diagram illustrating a method for generating a word cloud according to an embodiment of this application;

[0031] Figure 10b A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application;

[0032] Figure 10c A schematic diagram illustrating yet another method for generating a word cloud provided in an embodiment of this application;

[0033] Figure 10d A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application;

[0034] Figure 10e A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application;

[0035] Figure 10f A schematic diagram illustrating yet another method for generating a word cloud provided in an embodiment of this application;

[0036] Figure 10g A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application; Figure 11a A schematic diagram illustrating a method for generating a word cloud according to an embodiment of this application;

[0037] Figure 11b A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application;

[0038] Figure 11c A schematic diagram illustrating yet another method for generating a word cloud provided in an embodiment of this application;

[0039] Figure 11d A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application;

[0040] Figure 11e A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application;

[0041] Figure 11f A schematic diagram illustrating yet another method for generating a word cloud provided in an embodiment of this application; Figure 11g A schematic diagram illustrating another method for generating a word cloud provided in an embodiment of this application;

[0042] Figure 12 A schematic diagram of a word cloud generation device provided in an embodiment of this application;

[0043] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0044] To facilitate understanding and explanation of the technical solutions provided in the embodiments of this application, the background technology of this application will be described first.

[0045] To facilitate understanding of the technical solutions provided in this application, the background technology involved in this application will be explained below.

[0046] After studying traditional word cloud generation methods, it was found that current word cloud generation processes involve placing words sequentially based on pre-defined lines. During word placement, pixel-by-pixel detection or quadtree detection methods are used to check for collisions between words.

[0047] The pixel-by-pixel detection method iterates through each pixel in the image containing different words. It determines whether a word collision occurs by comparing whether the corresponding pixels in the images containing different words all represent the word's display color. For example, consider placing black words A and B in an image against a white background. It iterates through each pixel in the image containing word A and the image containing word B. If both the pixel in the image containing word A and the corresponding pixel in the image containing word B are black, then both words occupy that pixel, and a collision occurs between words A and B.

[0048] A quadtree is created by slicing an image horizontally and vertically, dividing it into four equal regions: top-left, bottom-left, top-right, and bottom-right. If a region contains content, it is further divided into four parts until the region size is less than a preset value. When detecting word collisions, two quadtrees are constructed for each word. The first-level rectangles of the two quadtrees are checked for overlap. If not, the two words do not overlap. If they do, the two words may overlap, and the two quadtrees are further divided, and the second-level rectangles are checked for overlap. If not, the two words do not overlap. If they do, the two quadtrees may overlap, and the next step of division is performed, checking for overlap. This process continues until the two words are determined to be non-overlapping, or the quadtree division level reaches a preset value.

[0049] Pixel-by-pixel detection and quadtree detection methods are complex and computationally intensive. This results in poor performance of word cloud generation algorithms, making it difficult to meet users' needs for generating word clouds.

[0050] Based on this, embodiments of this application provide a method, apparatus, device, and storage medium for generating a word cloud. The method involves acquiring multiple texts to be arranged and generating text arrangement lines in a canvas area; then, based on these text arrangement lines, determining the positions of the texts to be arranged sequentially to obtain a word cloud. The grids occupied by adjacent texts to be arranged do not overlap. The grids obtained based on the canvas area division can detect whether the texts to be arranged collide. Each grid includes multiple pixels, resulting in a relatively large granularity. Detecting collisions of texts based on the grid has low complexity, simplifying the computational burden of generating the word cloud.

[0051] To facilitate understanding of the word cloud generation method provided in the embodiments of this application, the following is combined with... Figure 1 The example scenario is shown below. See also... Figure 1 As shown in the figure, this figure is a schematic diagram of an exemplary application scenario provided in the embodiments of this application.

[0052] In practical applications, first obtain the text to be arranged. The text to be arranged includes text A, text B, and text C. Generate a spiral text arrangement line within the canvas area. The text arrangement line includes placement points. The placement point is the center position where the text to be arranged is placed. The canvas area includes a grid. See also Figure 1 As shown, the grid is represented by dashed lines. A grid is obtained by dividing the canvas area. A grid consists of multiple pixels. The text to be arranged is placed according to the text layout lines. The grids occupied by text A, text B, and text C are shown in the shaded area. The grids occupied by text A, text B, and text C do not overlap. A word cloud is generated based on the arranged text A, text B, and text C. The granularity of the grid is relatively large; arranging the text to be arranged based on the grid reduces complexity and computational cost.

[0053] Those skilled in the art will understand that Figure 1 The schematic diagram shown is merely one example in which embodiments of this application can be implemented. The scope of application of the embodiments of this application is not limited by any aspect of this framework.

[0054] To facilitate understanding of the technical solutions provided in the embodiments of this application, a method for generating word clouds provided in the embodiments of this application will be described below with reference to the accompanying drawings.

[0055] See Figure 2 As shown, this figure is a flowchart of a word cloud generation method provided in an embodiment of this application. Figure 2 As shown, the method may include S201-S203:

[0056] S201: Obtain at least two texts to be displayed.

[0057] The text to be arranged is the text that needs to be arranged to generate a word cloud. The text to be arranged may be, for example, words or short phrases. This application does not limit the source of the text to be arranged. In some possible implementations, the text to be arranged may be key text determined from articles, web page text, search term sets, etc. It should be noted that multiple texts are used to generate the word cloud.

[0058] S202: Generate text placement lines within the canvas area, the text placement lines being used to determine the location where the text to be placed will be placed.

[0059] The canvas area is the editing area for generating the word cloud. Within the canvas area, text placement lines are generated to determine the placement position of the text to be placed.

[0060] This application does not limit the method of generating text lines. In one possible implementation, the text lines are generated based on a function. The specific shape of the text lines is determined by the type of the function and its parameters. The type of the function determines the shape of the text lines. The parameters of the function determine the density of the text lines and the aspect ratio of the area they occupy. For example, see... Figure 3 As shown, this figure is a schematic diagram of a text emission line provided in an embodiment of this application. The text emission line is a spiral-shaped emission line generated using a distance field function. Figure 3 The text line shown is for illustrative purposes only. Text lines can also be elliptical, star-shaped, etc.

[0061] In another possible implementation, the text emission lines are generated based on the image shape. For example, the desired word cloud might be in the shape of a smiley face. See also Figure 4 As shown, this figure is a schematic diagram of another text rendering line provided in an embodiment of this application. The text rendering line is determined based on the shape of the facial expression.

[0062] The text placement line is used to determine the location of the text to be placed. In some possible implementations, the center point of the text to be placed is on the text placement line. In other possible implementations, the text placement line includes the placement point. See also Figure 5 As shown, this figure is a schematic diagram of a text placement line provided in an embodiment of this application. The points on the text placement line are placement points. Each placement point is the center point of the text to be placed. The distance between placement points on the text placement line can be preset.

[0063] S203: Determine the position of the text to be displayed according to the text display line to obtain a word cloud. The grids occupied by the adjacent texts to be displayed do not overlap. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels.

[0064] The canvas area is divided into grids. As an example, the grid is rectangular, obtained by horizontally and vertically dividing the canvas area. This application does not limit the method of grid division. See also some possible implementations. Figure 6 As shown, this figure is a schematic diagram of a grid provided in an embodiment of this application. The canvas area is uniformly divided horizontally and vertically to obtain a grid of rectangular cells of the same size. In some other possible implementations, the canvas area can be first divided into multiple sub-regions. Each sub-region is then further divided. The grid sizes obtained from different sub-region divisions may differ. For example, see... Figure 7 As shown in the figure, this is a schematic diagram of another grid provided in an embodiment of this application. First, the canvas area is divided into a central area and an edge area. Then, the central area and the edge area are further divided to obtain grids of different sizes. The grid in the central area is larger, and the grid in the edge area is smaller.

[0065] It should be noted that each grid cell comprises multiple pixels. The size of the grid cell affects the sparsity of the text distribution. Specifically, a larger grid cell occupies a larger area of ​​the grid, and the greater the distance between adjacent text elements. Conversely, a smaller grid cell occupies a smaller area of ​​the grid, and the smaller the distance between adjacent text elements. The grid size can be set based on a predetermined density of the text to be displayed. Figure 7 Taking the grid shown as an example, after placing the text to be placed, the text to be placed in the central area is arranged more densely, while the text to be placed in the edge area is arranged more sparsely.

[0066] Based on text placement lines, the position of the text to be placed is determined. This application does not limit the specific implementation method of determining the position of the text to be placed according to text placement lines. In one possible implementation, the text placement lines include placement points. This application provides a specific implementation method for determining the position of the text to be placed according to text placement lines to obtain a word cloud, as detailed below. In another possible implementation, a greedy strategy is used to determine the position of the text to be placed based on text placement lines.

[0067] It should be noted that the embodiments of this application do not limit the placement direction of the text to be displayed. For example, in some possible implementations, the text to be displayed is placed along a horizontal or vertical direction. In other possible implementations, the text to be displayed is placed at a preset angle to the horizontal direction. The placement directions of the texts to be displayed that make up the same word cloud can be the same or different.

[0068] The text to be displayed, arranged according to the text display line, occupies a grid. This application does not limit the specific implementation method for determining the grid occupied by the text to be displayed. In some possible implementations, the grid occupied by the text to be displayed can be determined based on the grid to which the pixels occupied by the text to be displayed belong. In other possible implementations, the enclosing matrix of the text to be displayed is first determined, and the grid occupied by the text to be displayed is determined based on the grid occupied by the enclosing matrix. See also Figure 8 As shown, this figure is a schematic diagram of a bounding matrix for text to be displayed, provided in an embodiment of this application. The bounding matrix is ​​used to determine the edges of the text to be displayed. The bounding matrix of the text to be displayed is determined based on the width and height of the text. In some possible implementations, the width of the words to be displayed is measured and determined. As an example, after determining the placement position of the text to be displayed, an interface is called to measure the width of the text. The height of the text to be displayed is determined based on the font and font size of the text. Based on the font and font size of the text to be displayed, the height of a single line of text can be determined. As another example, the text to be displayed is multi-line text. Based on determining the height of a single line of text based on the font and font size, the overall height of the text to be displayed is then determined based on the number of lines of the text.

[0069] The grid cells occupied by adjacent text to be displayed do not overlap, thus confirming that there is no collision, or overlap, between the texts to be displayed. Using a grid system makes it relatively easy to determine whether texts to be displayed overlap, reducing the complexity of overlap detection and simplifying the computational cost of generating word clouds.

[0070] This application does not limit the method for determining whether adjacent text to be displayed occupies overlapping grid cells. As an example, grid cells can be pre-assigned identifiers. The grid identifiers can be determined based on the grid's position within the canvas area. The identifiers of the grid cells occupied by different text cells to be displayed are recorded separately. By determining whether the identifiers of the grid cells occupied by different text cells to be displayed are the same, it is possible to determine whether the text cells to be displayed overlap. As another example, already occupied grid cells can be recorded. After adding new text cells to be displayed, by determining whether the newly added text cells to be displayed include already occupied grid cells, it is possible to determine whether the text cells to be displayed overlap.

[0071] In some possible implementations, it's impossible to determine the position of all the text to be placed according to the text placement lines. For example, the text placement lines may be too short, or the canvas area may be too small. One possible implementation is to discard the text that cannot be placed. Another possible implementation is to extend the text placement lines or expand the canvas area.

[0072] In some possible implementations, the text placement line includes multiple placement points. When determining the position of the text to be placed, it can be placed on the placement points such that the center point of the text to be placed coincides with the placement point. However, during the placement of the text to be placed, it is necessary to ensure that the text to be placed does not overlap with other text to be placed already placed. This application embodiment provides a specific implementation method for determining the position of the text to be placed according to the text placement line, and obtaining a word cloud, when the text placement line includes multiple placement points. See also... Figure 9 As shown, this figure is a flowchart of a word cloud generation method provided in an embodiment of this application. Figure 9 As shown, the method may include S901-S905:

[0073] S901: Place the first text to be published at the initial placement point of the text publication line, and determine the grid occupied by the first text to be published as the occupied grid.

[0074] When placing text along the text release line, a specific arrangement order is required. In some possible implementations, the arrangement order is from one endpoint of the text release line to the other. Figure 5 Taking the text layout line as an example, the layout order is along the text layout line, from the endpoint of the text layout line located at the center of the canvas area to the endpoint located at the edge of the canvas area.

[0075] Based on the arrangement order, the first placement point for the text to be placed is the initial placement point. The first text to be placed is then placed at the initial placement point. This first text can be any of the texts to be placed, or it can be determined based on the text's arrangement order. In some possible implementations, the texts to be placed have corresponding weights. The placement order can be determined based on these weights. For example, texts with higher weights are placed first.

[0076] When the first text to be placed is positioned, there are no other texts already placed, so there is no need to consider the issue of overlap with other texts to be placed. The grid cell occupied by the first text to be placed is defined as an occupied grid cell.

[0077] This application does not limit the specific implementation of determining the grid occupied by the first text to be displayed. The method of determining the grid occupied by the first text to be displayed is similar to the method of determining the grid occupied by the text to be displayed described in S203 above, and will not be repeated here.

[0078] S902: According to the arrangement order, the nth text to be placed is placed at the placement point of the text placement line in sequence until the grid occupied by the nth text to be placed does not overlap with the already occupied grid. The initial value of n is 2, and n is a positive integer greater than or equal to 2 and less than or equal to the number of texts to be placed.

[0079] The arrangement order can be determined based on the text placement line. For example, along the text placement line, from one end to the other. After placing the nth text to be placed at the placement point, it is determined whether the grid occupied by the nth text to be placed overlaps with an already occupied grid. If the grid occupied by the nth text to be placed overlaps with an already occupied grid, then the nth text to be placed is placed at the next placement point according to the arrangement order, and the grid occupied by the nth text to be placed overlaps with an already occupied grid again, and so on, until the grid occupied by the nth text to be placed no longer overlaps with an already occupied grid.

[0080] The initial value of n is 2. The value of n is a positive integer greater than or equal to 2 and less than or equal to the number of texts to be displayed.

[0081] It should be noted that in some possible implementations, each subsequent text to be placed starts from the next placement point after the placement point of the text to be placed at the previous defined position. That is, each placement point can only attempt to place text once. In other possible implementations, each text to be placed is arranged in the order of arrangement, starting from the first placement point, attempting to place it at placement points where no text to be placed has yet been placed.

[0082] S903: Determine the position of the nth text to be released based on the placement point of the nth text to be released, and determine the grid occupied by the nth text to be released as the occupied grid.

[0083] The position of the nth text to be placed is determined based on its current placement point. After determining the position of the nth text to be placed, the occupied grid is updated. In addition to the previously determined occupied grids, the grid occupied by the nth text to be placed is also determined as an occupied grid. The method for determining the grid occupied by the nth text to be placed is similar to the method for determining the grid occupied by the text to be placed as described in S203 above, and will not be repeated here.

[0084] S904: Increment the value of n by 1.

[0085] S905: Determine whether all placement points of the text placement line have been attempted, or whether the positions of the text to be placed have been determined.

[0086] If there are text placement points that have not been attempted to place the text to be placed, and there are text to be placed without a determined location, then return to execute S902.

[0087] If the placement point of the text placement line does not attempt to place the text to be placed, it means that the placement points of the text to be placed have not been used up, and there are texts to be placed that have not been determined in a certain position. This means that the placement of the text to be placed can continue, but the placement of the text to be placed has not been completed.

[0088] If all placement points of the text placement line have been attempted to place the text to be placed, or if the positions of the text to be placed have been determined, then execute S906.

[0089] If all placement points on the text placement line have been attempted to place the text to be placed, it means that all placement points for the text to be placed have been used up, and no more text can be placed, thus completing the placement of the text to be placed. If the placement positions for all the text to be placed have been determined, then the placement of the text to be placed is complete.

[0090] S906: Obtain the word cloud.

[0091] After placing the text to be placed, a word cloud is obtained. The word cloud only displays the text to be placed at a specific location.

[0092] In some possible implementations, the text to be displayed has weights. The weight of the text to be displayed can be determined based on its importance. For example, the higher the frequency of the text to be displayed in the original text, the greater its weight. Or, the higher the popularity of the text to be displayed, the greater its weight.

[0093] When the text to be displayed has weights, this application embodiment provides a specific implementation method for determining the position of the text to be displayed according to the text display line to obtain a word cloud, including the following two steps:

[0094] A1: Determine the placement order of the texts to be placed according to their weights from largest to smallest.

[0095] As one example, the text to be placed is based on text placement lines, ranging from the center of the canvas area to its edges. The greater the weight of the text to be placed, the earlier it appears in the placement order; conversely, the smaller the weight, the later it appears. As another example, the text to be placed is based on text placement lines, ranging from the edges of the canvas area to its center. Again, the greater the weight of the text to be placed, the later it appears in the placement order; and the smaller the weight, the earlier it appears.

[0096] A2: Based on the text placement lines, determine the position of the text to be placed according to the placement order to obtain a word cloud.

[0097] Following the weight-based placement order, the text to be placed is placed sequentially according to the text placement lines to determine the position of the text to be placed, thus obtaining a word cloud.

[0098] Furthermore, the font size of the text to be displayed is also related to its weight. In one possible implementation, the larger the weight of the text to be displayed, the larger the font size; the smaller the weight, the smaller the font size. As an example, first determine the largest and smallest weights in the text to be displayed. Establish a correspondence between the largest weight and a pre-set largest font size, and between the smallest weight and a pre-set smallest font size. Divide the font size between the largest and smallest font sizes based on the difference between the largest and smallest weights. For example, the largest weight is 90%, and the smallest weight is 50%. The difference between the largest and smallest weights is 40%. The pre-set largest font size is 20, and the smallest font size is 10. The difference between the largest and smallest font sizes is 10. Dividing the font size by 10 based on 40% yields a difference of 2.5 font sizes for every 10% weight difference. For example, the font size of the text to be displayed with a weight of 70% is 15.

[0099] The following two examples illustrate the methods for generating the word cloud. It should be noted that these two examples represent only two possible implementations.

[0100] As an example, the text placement line is spiral-shaped. The grid is obtained by uniformly dividing the canvas area. The text to be placed includes: text A, text B, text C, and text D. The placement order is along the text placement line, from the endpoint of the text placement line located at the center of the canvas area to the endpoint located at the edge of the canvas area.

[0101] See Figures 10a-10g As shown in the figure, this figure is a schematic diagram of a word cloud generation method provided in an embodiment of this application.

[0102] First, randomly select text B from multiple texts to be displayed as the first text to be displayed. For example... Figure 10a As shown, text B is placed at the initial placement point. The enclosing matrix of text B is determined, and the grid cells occupied by the enclosing matrix of text B are defined as occupied grid cells. Then, text C is randomly selected from multiple unplaced texts as the nth text to be placed. Here, n is 2. Text C is the second text to be placed. Figure 10b As shown, text C is placed at the second placement point determined according to the arrangement order, and its enclosing matrix is ​​determined. The grid space occupied by text C is determined based on its enclosing matrix. It is then determined whether the grid space occupied by text C overlaps with already occupied grid spaces. If the grid space occupied by text C overlaps with already occupied grid spaces, then... Figure 10c As shown, text C is placed at the third placement point determined according to the arrangement order, and the enclosing matrix of text C is determined. The grid occupied by text C is determined based on the enclosing matrix. It is then determined whether the grid occupied by text C overlaps with existing grids. The grid of text C does not overlap with existing grids. The third placement point is then determined as the placement point for text C. The grid occupied by text C is determined as an occupied grid. The value of n is incremented by 1, and the value of n is 3. Then, text A is randomly selected from the multiple unplaced texts to be placed as the nth text to be placed, which is the third text to be placed. (The text continues with further details about the process.) Figure 10d As shown, text A is placed at the fourth placement point determined according to the arrangement order, and the enclosing matrix of text A is determined. The grid occupied by text A is determined based on the enclosing matrix. It is then determined whether the grid occupied by text A overlaps with already occupied grids. The grid of text A does not overlap with already occupied grids. The fourth placement point is then determined as the placement point for text A. The grid occupied by text A is determined as an occupied grid. The value of n is incremented by 1, and the value of n is 4. The unplaced text D is then taken as the nth text to be placed, which is the fourth text to be placed. (The text continues with further details about the placement process.) Figure 10e As shown, text D is placed at the fifth position determined according to the arrangement order, and the enclosing matrix of text D is determined. The grid area occupied by text D is determined based on the enclosing matrix. It is then determined whether the grid area occupied by text D overlaps with already occupied grid areas. If the grid area of ​​text D overlaps with already occupied grid areas, then... Figure 10f As shown, text D is placed at the sixth placement point determined according to the arrangement order, and the enclosing matrix of text D is determined. The grid occupied by text D is determined based on the enclosing matrix. It is then determined whether the grid occupied by text D overlaps with already occupied grids. The grid of text D does not overlap with already occupied grids. The sixth placement point is then determined as the placement point for text D. The grid occupied by text D is then determined as an occupied grid. The positions of all text to be placed have been determined, as shown... Figure 10g As shown, a word cloud is obtained.

[0103] As another example, the text placement line is spiral-shaped, comprising five placement points. The grid is a uniformly divided canvas area. The text to be placed includes: Text A, Text B, Text C, and Text D. The text to be placed, in descending order of weight, is Text A, Text B, Text C, and Text D. Based on the weights of the text to be placed, the placement order is determined to be Text A, Text B, Text C, and Text D. Based on the descending weights, the font sizes of Text A, Text B, Text C, and Text D also gradually decrease. The placement order is along the text placement line, from the endpoint of the text placement line located at the center of the canvas area to the endpoint located at the edge of the canvas area.

[0104] See Figures 11a-11g As shown in the figure, this figure is a schematic diagram of a word cloud generation method provided in an embodiment of this application.

[0105] like Figure 11a As shown, text A is placed at the initial placement point. The enclosing matrix of text A is determined, and the grid cells occupied by the enclosing matrix of text A are defined as occupied grid cells. Then, following the placement order, text B is placed as the nth text to be placed. Here, n is 2. Text B is the second text to be placed. The initial placement point is already occupied, as shown... Figure 11b As shown, text B is placed at the second position determined according to the arrangement order, and its enclosing matrix is ​​determined. The grid space occupied by text B is determined based on its enclosing matrix. It is then determined whether the grid space occupied by text B overlaps with existing grid spaces. If text B's grid space overlaps with existing grid spaces, then... Figure 11c As shown, text B is placed at the third placement point determined according to the arrangement order, and the enclosing matrix of text B is determined. The grid occupied by text B is determined based on the enclosing matrix. It is then determined whether the grid occupied by text B overlaps with already occupied grids. The grid of text B does not overlap with already occupied grids. The third placement point is determined as the placement point for text B. The grid occupied by text B is determined as an occupied grid. The value of n is incremented by 1, and the value of n is 3. Text C is designated as the nth text to be placed, which is the third text to be placed. The initial placement point is already occupied, as shown... Figure 11d As shown, first place text C at the second placement point and determine the enclosing matrix of text C. Based on the enclosing matrix of text C, determine the grid area occupied by text C. Determine if the grid area occupied by text C overlaps with an already occupied grid. If the grid area occupied by text C overlaps with an already occupied grid, the third placement point is already occupied, as shown. Figure 11e As shown, text C is placed at the fourth position determined according to the arrangement order, and its enclosing matrix is ​​determined. The grid space occupied by text C is determined based on its enclosing matrix. It is then determined whether the grid space occupied by text C overlaps with existing grid spaces. If the grid space occupied by text C overlaps with existing grid spaces, then... Figure 11fAs shown, text C is placed at the fifth placement point determined according to the arrangement order, and the enclosing matrix of text C is determined. The grid occupied by text C is determined based on the enclosing matrix. It is then determined whether the grid occupied by text C overlaps with existing grids. The grid of text C does not overlap with existing grids. The fifth placement point is then determined as the placement point for text C. The grid occupied by text C is then determined as an occupied grid. All placement points for the text lines have been attempted, completing the generation of the word cloud. Figure 11g As shown, a word cloud is obtained.

[0106] Based on the word cloud generation method provided in the above-described method embodiments, this application also provides a word cloud generation apparatus, which will be described below with reference to the accompanying drawings.

[0107] See Figure 12 As shown, this figure is a schematic diagram of the structure of a word cloud generation device provided in an embodiment of this application. Figure 12 As shown, the device for generating the word cloud includes:

[0108] Acquisition unit 1201 is used to acquire at least two texts to be displayed;

[0109] The generation unit 1202 is used to generate text placement lines within a canvas area, the text placement lines being used to determine the position where the text to be placed is located;

[0110] The determining unit 1203 is used to determine the position of the text to be placed according to the text placement line to obtain a word cloud. The grids occupied by the adjacent texts to be placed do not overlap with each other. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels.

[0111] In some possible implementations, the text emission line includes at least two placement points;

[0112] The determining unit 1203 is used to place the first text to be released at the initial placement point of the text release line, and to determine the grid occupied by the first text to be released as an occupied grid.

[0113] Repeat the following steps until all placement points of the text placement lines have been attempted, or the positions of all text to be placed have been determined, to obtain a word cloud:

[0114] According to the arrangement order, the nth text to be placed is placed at the placement point of the text placement line in sequence until the grid occupied by the nth text to be placed does not overlap with the already occupied grid. The initial value of n is 2, and n is a positive integer greater than or equal to 2 and less than or equal to the number of texts to be placed.

[0115] The position of the nth text to be released is determined based on the placement point of the nth text to be released, and the grid occupied by the nth text to be released is determined as the occupied grid.

[0116] Increment the value of n by 1.

[0117] In some possible implementations, the text to be displayed has a corresponding weight.

[0118] In some possible implementations, the determining unit 1203 is used to determine the placement order of the text to be placed according to the order of their weights from largest to smallest.

[0119] Based on the text placement lines, the position of the text to be placed is determined according to the placement order, and a word cloud is obtained.

[0120] In some possible implementations, the font size of the text to be displayed is determined based on the weight of the text to be displayed.

[0121] In some possible implementations, the grid occupied by the text to be displayed is the grid occupied by the enclosing matrix of the text to be displayed, which is determined based on the width and height of the text to be displayed.

[0122] In some possible implementations, the width of the text to be displayed is determined by measurement, and the length of the text to be displayed is determined based on the font and font size of the text to be displayed.

[0123] In some possible implementations, the grid is obtained by dividing the canvas area into rectangles of the same size.

[0124] In some possible implementations, the size of the grid is determined based on the density of the text to be displayed.

[0125] In some possible implementations, the text emission line is generated based on a function or based on an image shape.

[0126] Based on the word cloud generation method provided in the above embodiments, this application also provides an electronic device, including: one or more processors; a storage device storing one or more programs thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the word cloud generation method described in any of the above embodiments. References below... Figure 13This document illustrates a structural schematic diagram of an electronic device 1300 suitable for implementing embodiments of this application. The terminal devices in these embodiments may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Android devices), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs (television sets), desktop computers, etc. Figure 13 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0127] like Figure 13 As shown, electronic device 1300 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 1301, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 1302 or a program loaded from storage device 1306 into random access memory (RAM) 1303. RAM 1303 also stores various programs and data required for the operation of electronic device 1300. Processing device 1301, ROM 1302, and RAM 1303 are interconnected via bus 1304. Input / output (I / O) interface 1305 is also connected to bus 1304.

[0128] Typically, the following devices can be connected to I / O interface 1305: input devices 1306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 1307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1306 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1309. Communication device 1309 allows electronic device 1300 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 13 An electronic device 1300 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0129] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1309, or installed from storage device 1306, or installed from ROM 1302. When the computer program is executed by processing device 1301, it performs the functions defined in the methods of embodiments of this application.

[0130] The electronic device provided in this application embodiment and the word cloud generation method provided in the above embodiment belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0131] Based on the word cloud generation method provided in the above embodiments, this application provides a computer-readable medium storing a computer program thereon, wherein the program, when executed by a processor, implements the word cloud generation method as described in any of the above embodiments.

[0132] It should be noted that the computer-readable medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0133] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0134] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0135] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the aforementioned word cloud generation method.

[0136] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include, but are not limited to, object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone 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 remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0137] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0138] The units described in the embodiments of this application can be implemented in software or in hardware. The name of the unit / module does not necessarily limit the unit itself; for example, a voice data acquisition module can also be described as a "data acquisition module".

[0139] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0140] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0141] According to one or more embodiments of this application, [Example 1] provides a method for generating a word cloud, the method comprising:

[0142] Obtain at least two texts to be displayed;

[0143] Generate text placement lines within the canvas area; the text placement lines are used to determine the position where the text to be placed will be positioned.

[0144] According to the text placement line, the position of the text to be placed is determined to obtain a word cloud. The grids occupied by the adjacent texts to be placed do not overlap with each other. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels.

[0145] According to one or more embodiments of this application, [Example 2] provides a method for generating a word cloud, wherein the text placement line includes at least two placement points, and the step of determining the position of the text to be placed according to the text placement line to obtain a word cloud includes:

[0146] Place the first text to be published at the initial placement point of the text publication line, and determine the grid occupied by the first text to be published as the occupied grid.

[0147] Repeat the following steps until all placement points of the text placement lines have been attempted, or the positions of all text to be placed have been determined, to obtain a word cloud:

[0148] According to the arrangement order, the nth text to be placed is placed at the placement point of the text placement line in sequence until the grid occupied by the nth text to be placed does not overlap with the already occupied grid. The initial value of n is 2, and n is a positive integer greater than or equal to 2 and less than or equal to the number of texts to be placed.

[0149] The position of the nth text to be released is determined based on the placement point of the nth text to be released, and the grid occupied by the nth text to be released is determined as the occupied grid.

[0150] Increment the value of n by 1.

[0151] According to one or more embodiments of this application, [Example 3] provides a method for generating a word cloud, wherein the text to be displayed has corresponding weights.

[0152] According to one or more embodiments of this application, [Example 4] provides a method for generating a word cloud, wherein determining the position of the text to be arranged according to the text arrangement lines to obtain the word cloud includes:

[0153] The placement order of the texts to be placed is determined according to their weights from largest to smallest.

[0154] Based on the text placement lines, the position of the text to be placed is determined according to the placement order, and a word cloud is obtained.

[0155] According to one or more embodiments of this application, [Example 5] provides a method for generating a word cloud, wherein the font size of the text to be displayed is determined based on the weight of the text to be displayed.

[0156] According to one or more embodiments of this application, [Example Six] provides a method for generating a word cloud, wherein the grid occupied by the text to be displayed is the grid occupied by the enclosing matrix of the text to be displayed, and the enclosing matrix is ​​determined based on the width and height of the text to be displayed.

[0157] According to one or more embodiments of this application, [Example 7] provides a method for generating a word cloud, wherein the width of the text to be displayed is determined by measurement, and the length of the text to be displayed is determined based on the font and font size of the text to be displayed.

[0158] According to one or more embodiments of this application, [Example 8] provides a method for generating a word cloud, wherein the grid is obtained by dividing the canvas area into rectangles of the same size.

[0159] According to one or more embodiments of this application, [Example Nine] provides a method for generating a word cloud, wherein the size of the grid is determined based on the density of the text to be displayed.

[0160] According to one or more embodiments of this application, [Example 10] provides a method for generating a word cloud, wherein the text lines are generated based on a function or based on an image shape.

[0161] According to one or more embodiments of this application, [Example 11] provides a word cloud generation apparatus, the apparatus comprising:

[0162] The acquisition unit is used to acquire at least two texts to be displayed.

[0163] A generation unit is used to generate text placement lines within a canvas area, the text placement lines being used to determine the position where the text to be placed is located;

[0164] The determining unit is used to determine the position of the text to be placed according to the text placement line to obtain a word cloud. The grids occupied by the adjacent texts to be placed do not overlap with each other. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels.

[0165] According to one or more embodiments of this application, [Example Twelve] provides a word cloud generation apparatus, wherein the text layout line includes at least two placement points;

[0166] The determining unit is used to place the first text to be released at the initial placement point of the text release line, and to determine the grid occupied by the first text to be released as an occupied grid.

[0167] Repeat the following steps until all placement points of the text placement lines have been attempted, or the positions of all text to be placed have been determined, to obtain a word cloud:

[0168] According to the arrangement order, the nth text to be placed is placed at the placement point of the text placement line in sequence until the grid occupied by the nth text to be placed does not overlap with the already occupied grid. The initial value of n is 2, and n is a positive integer greater than or equal to 2 and less than or equal to the number of texts to be placed.

[0169] The position of the nth text to be released is determined based on the placement point of the nth text to be released, and the grid occupied by the nth text to be released is determined as the occupied grid.

[0170] Increment the value of n by 1.

[0171] According to one or more embodiments of this application, [Example Thirteen] provides a word cloud generation apparatus, wherein the text to be displayed has corresponding weights.

[0172] According to one or more embodiments of this application, [Example Fourteen] provides a word cloud generation apparatus, wherein the determining unit is configured to determine the placement order of the text to be placed according to the order of their weights from largest to smallest;

[0173] Based on the text placement lines, the position of the text to be placed is determined according to the placement order, and a word cloud is obtained.

[0174] According to one or more embodiments of this application, [Example Fifteen] provides a word cloud generation apparatus, wherein the font size of the text to be displayed is determined based on the weight of the text to be displayed.

[0175] According to one or more embodiments of this application, [Example Sixteen] provides a word cloud generation apparatus, wherein the grid occupied by the text to be displayed is the grid occupied by the enclosing matrix of the text to be displayed, and the enclosing matrix is ​​determined based on the width and height of the text to be displayed.

[0176] According to one or more embodiments of this application, [Example Seventeen] provides a word cloud generation apparatus, wherein the width of the text to be displayed is determined by measurement, and the length of the text to be displayed is determined based on the font and font size of the text to be displayed.

[0177] According to one or more embodiments of this application, [Example 18] provides a word cloud generation apparatus, wherein the grid is obtained by dividing the canvas area into rectangles of the same size.

[0178] According to one or more embodiments of this application, [Example 19] provides a word cloud generation apparatus, wherein the size of the grid is determined based on the density of the text to be displayed.

[0179] According to one or more embodiments of this application, [Example 20] provides a word cloud generation apparatus, wherein the text lines are generated based on a function or based on an image shape.

[0180] According to one or more embodiments of this application, [Example Twenty-One] provides an electronic device, including:

[0181] One or more processors;

[0182] Storage device, on which one or more programs are stored,

[0183] When the one or more programs are executed by the one or more processors, the one or more processors implement the word cloud generation method as described in any of [Example 1] - [Example 10].

[0184] According to one or more embodiments of this application, [Example 22] provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements a method for generating a word cloud as described in any of [Example 1] to [Example 10].

[0185] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems or apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.

[0186] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0187] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0188] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0189] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating word clouds, characterized in that, The method includes: Obtain at least two texts to be displayed; A text placement line is generated within a canvas area, the text placement line being used to determine the position where the text to be placed is to be placed; the canvas area includes a grid. According to the text placement line, the position of the text to be placed is determined to obtain a word cloud. The grids occupied by adjacent texts to be placed do not overlap. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels. The text placement line includes at least two placement points. Determining the position of the text to be placed according to the text placement line to obtain a word cloud includes: Place the first text to be published at the initial placement point of the text publication line, and determine the grid occupied by the first text to be published as the occupied grid. Repeat the following steps until all placement points of the text placement lines have been attempted, or the positions of all text to be placed have been determined, to obtain a word cloud: According to the arrangement order, the nth text to be placed is placed at the placement point of the text placement line in sequence until the grid occupied by the nth text to be placed does not overlap with the already occupied grid. The initial value of n is 2, and n is a positive integer greater than or equal to 2 and less than or equal to the number of texts to be placed. The position of the nth text to be released is determined based on the placement point of the nth text to be released, and the grid occupied by the nth text to be released is determined as the occupied grid. Increment the value of n by 1.

2. The method according to claim 1, characterized in that, The text to be displayed has a corresponding weight.

3. The method according to claim 2, characterized in that, The step of determining the position of the text to be displayed according to the text display line to obtain a word cloud includes: The placement order of the texts to be placed is determined according to their weights from largest to smallest. Based on the text placement lines, the position of the text to be placed is determined according to the placement order, and a word cloud is obtained.

4. The method according to claim 2, characterized in that, The font size of the text to be displayed is determined based on the weight of the text to be displayed.

5. The method according to claim 1, characterized in that, The grid occupied by the text to be displayed is the grid occupied by the enclosing matrix of the text to be displayed, which is determined based on the width and height of the text to be displayed.

6. The method according to claim 5, characterized in that, The width of the text to be displayed is determined by measurement, and the length of the text to be displayed is determined based on the font and font size of the text to be displayed.

7. The method according to claim 1, characterized in that, The grid is obtained by dividing the canvas area into rectangles of the same size.

8. The method according to claim 1, characterized in that, The size of the grid is determined based on the density of the text to be displayed.

9. The method according to claim 1, characterized in that, The text lines are generated based on a function or based on an image shape.

10. A device for generating word clouds, characterized in that, The device includes: The acquisition unit is used to acquire at least two texts to be displayed. A generation unit is used to generate text placement lines within a canvas area, the text placement lines being used to determine the position where the text to be placed is to be placed; the canvas area includes a grid. The determining unit is used to determine the position of the text to be placed according to the text placement line, and to obtain a word cloud. The grids occupied by adjacent texts to be placed do not overlap with each other. The grid is obtained by dividing the canvas area, and each grid includes multiple pixels. The text placement line includes at least two placement points, and the determining unit is specifically used for: Place the first text to be published at the initial placement point of the text publication line, and determine the grid occupied by the first text to be published as the occupied grid. Repeat the following steps until all placement points of the text placement lines have been attempted, or the positions of all text to be placed have been determined, to obtain a word cloud: According to the arrangement order, the nth text to be placed is placed at the placement point of the text placement line in sequence until the grid occupied by the nth text to be placed does not overlap with the already occupied grid. The initial value of n is 2, and n is a positive integer greater than or equal to 2 and less than or equal to the number of texts to be placed. The position of the nth text to be released is determined based on the placement point of the nth text to be released, and the grid occupied by the nth text to be released is determined as the occupied grid. Increment the value of n by 1.

11. An electronic device, characterized in that, include: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors implement the word cloud generation method as described in any one of claims 1-9.

12. A computer-readable medium, characterized in that, It stores a computer program, wherein the program, when executed by a processor, implements the method for generating a word cloud as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Word cloud diagram visualizing method based on occupation matrix

    CN103778213A

  • Method and device for generating shape word cloud

    CN110189393A