Character string operation method and character string operation device
The method and device address the issue of outdated time expressions in character strings by calculating date differences and updating time phrases using a transition model to maintain relevance.
Patent Information
- Application Number
- JP2024018572
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-02-09
- Publication Date
- 2025-08-22
AI Technical Summary
Existing information display devices fail to handle character string information that includes time expressions, leading to outdated data over time.
A method and device that calculates the difference between a first and second date and time, identifies time phrases in the string information, and updates them based on a transition model to maintain relevance.
Prevents character string information from becoming outdated by dynamically updating time phrases based on the difference between dates.
Smart Images

Figure 2025122866000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to a string manipulation method and a string manipulation device. [Background technology]
[0002] Patent Document 1 describes an information display device that can automatically change the display mode of the display unit over time. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] Japanese Patent Application Laid-Open No. 2011-81577 Summary of the Invention [Problem to be solved by the invention]
[0004] The information display device described in Patent Document 1 stores the input current time and age information in an age information storage unit, counts time starting from the current time, and updates the age information stored in the age information storage unit based on the counting result. The information display device described in Patent Document 1 has a table in which age information and the manner of displayed characters are recorded in association with each other, selects a predetermined character manner from the table according to the updated age information, converts the character manner of the information to be displayed to the selected character manner, and displays the information to be displayed in the converted character manner.
[0005] However, the invention described in Patent Document 1 simply converts the format of a specified character according to the user's age information, and cannot handle cases where the character string information describing the data includes expressions that indicate time, such as "yesterday" or "a few days ago," and the character string information becomes outdated over time.
[0006] The present invention has been made in view of the above, and its object is to provide a string manipulation method and a string manipulation device that can prevent string information describing data from becoming outdated over time. [Means for solving the problem]
[0007] A string manipulation method and a string manipulation device according to one aspect of the present invention calculate a difference between a first date and time to which string information describing data is assigned and an arbitrary second date and time, and extract a first time phrase included in the string information. Based on the first time phrase and a transition model that defines a time range for the first date and time that each of a plurality of time phrases expressing a temporal concept represents, a first time range that the first time phrase represents is identified in the transition model. A second time range that corresponds to the difference between the first date and time and an arbitrary second date and time is identified in the transition model. If the second time range exceeds the first time range, the string information is output after changing to a second time phrase that corresponds to the second time range in the transition model. [Effects of the Invention]
[0008] According to one aspect of the present invention, it is possible to prevent character string information describing data from becoming outdated over time. [Brief explanation of the drawings]
[0009] [Figure 1] FIG. 1 is a block diagram showing an example of the configuration of a character string manipulation device according to an embodiment. [Figure 2] FIG. 2 is a diagram showing examples of time phrases stored in the character string storage unit of FIG. [Figure 3] FIG. 2 is a diagram showing an example of a transition model stored in the time phrase storage unit of FIG. [Figure 4] FIG. 4 is a flowchart showing an example of processing executed by the character string manipulation device of FIG. DETAILED DESCRIPTION OF THE INVENTION
[0010] Hereinafter, an embodiment of the present invention will be described with reference to the drawings. In the description of the drawings, the same parts are given the same reference numerals and the description thereof will be omitted.
[0011] (Example of the configuration of a string manipulation device) 1 shows an example of the configuration of a string manipulation device 10 according to one embodiment. The string manipulation device 10 performs processing to manipulate strings included in string information that describes data such as an image. The string manipulation device 10 is used, for example, to manipulate strings included in string information when a neural network image recognition device (not shown) that classifies images creates string information for displaying and outputting an inference result that infers into which of multiple classes an input image should be classified.
[0012] The string manipulation device 10 is a general-purpose computer equipped with a CPU (Central Processing Unit), memory, a storage unit, an input / output unit, etc. A computer program is installed in the string manipulation unit 13. By executing the computer program, the string manipulation device 10 performs various processes. As shown in FIG. 1 , the string manipulation device 10 includes a string storage unit 11, an input unit 12, the string manipulation unit 13, a time phrase storage unit 14, and an output unit 15.
[0013] The character string storage unit 11 is a storage medium that stores character string information that describes data and information indicating a first date and time when the character string information is assigned. The character string storage unit 11 stores the character string information and information indicating the first date and time when the character string information is assigned, which are acquired from, for example, an image recognition device. The character string storage unit 11 can be, for example, a read only memory (ROM), a hard disk drive (HDD), a solid state drive (SSD), or a combination thereof.
[0014] Input unit 12 receives information indicating a second date and time, which is an arbitrary date and time input by the user. The second date and time input by the user is a date and time, such as the current date and time, that serves as a reference when string manipulation device 10 manipulates a string. Input unit 12 transmits the received information indicating the second date and time to string manipulation unit 13.
[0015] For example, when receiving input of information indicating a second date and time from the input unit 12, the string manipulation unit 13 acquires, from the string storage unit 11, the string information and information indicating the first date and time to which the string information is assigned. The string manipulation unit 13 calculates a difference between the first date and time and the second date and time. The string manipulation unit 13 also extracts, from the string information, a time phrase (first time phrase) that is included in the string information and expresses a temporal concept. The string manipulation unit 13 extracts a pre-registered time phrase included in the string information as the first time phrase.
[0016] Examples of time terms extracted by the character string manipulation unit 13 will now be described with reference to FIG. 2. A time term is a term expressing a temporal concept that is expected to be included in character string information describing data such as an image. As shown in FIG. 2, time terms include terms that specifically express a temporal concept, such as "today," "yesterday," "tomorrow," "this month," and "this year." Time terms also include terms that express a somewhat abstract temporal concept, such as "a few days ago" and "a few weeks later." Time terms also include highly subject-dependent terms, such as "current," "old model," "new model," and "next-generation model," in which the temporal concept they represent varies depending on the subject they describe. Furthermore, time terms also include terms that abstractly express a temporal concept, such as "modern," "novel," "old-fashioned," "futuristic," and "cutting-edge."
[0017] These time phrases become stale over time. For example, if the difference between the first date and time when character string information including the first time phrase "today" is assigned and the second date and time that serves as the reference for manipulating the character string is within one day, it can be said that the first time phrase "today" is not stale even at the second date and time that serves as the reference for manipulating the character string. However, if the difference between the first date and time when the first time phrase "today" is assigned and the second date and time that serves as the reference for manipulating the character string is two days or more, the date and time that the time phrase "today" meant at the first date and time becomes "yesterday" at the second date and time. Therefore, the first time phrase "today" becomes stale at the second date and time. The character string manipulation unit 13 changes the first time phrase "today" to the second time phrase "yesterday" to prevent the character string information including the first time phrase "today" from becoming stale.
[0018] A specific method for changing the first time phrase by the character string manipulation unit 13 will be described below. Based on the first time phrase included in the character string information and a transition model that defines the time ranges for the first date and time to which the character string information is assigned, which are meant by each of the multiple time phrases and that is stored in the time phrase storage unit 14, the character string manipulation unit 13 identifies the first time range meant by the first time phrase in the transition model.
[0019] An example of the transition model will be described with reference to Fig. 3. The transition model in Fig. 3 is a transition model that defines a time range for a first date and time to which character string information including each of the multiple time phrases "today," "yesterday," "two days ago," "several days ago," "one week ago," "last month," and "six months ago" is assigned.
[0020] In the transition model shown in FIG. 3, the time range indicated by the time phrase "today" is defined as a time range of less than one day from the first date and time. The time range indicated by the time phrase "yesterday" is defined as "one day" before the first date and time. The time range indicated by the time phrase "two days ago" is defined as "two days" before the first date and time. The time range indicated by the time phrase "a few days ago" is defined as "two to four days" before the first date and time. The time range indicated by the time phrase "one week ago" is defined as "six to eight days" before the first date and time. The time range indicated by the time phrase "last month" is defined as "29 to 32 days" before the first date and time. The time range indicated by the time phrase "six months ago" is defined as "170 to 190 days" before the first date and time. Note that the transition model shown in FIG. 3 is an example, and the definitions of the time ranges indicated by each time phrase are not limited to this.
[0021] Furthermore, the string manipulation unit 13 specifies a second time range in the transition model that corresponds to the difference between the first date and time at which the string information is assigned and the second date and time accepted by the input unit 12. If the second time range exceeds the first time range, the string manipulation unit 13 changes the first time phrase to a second time phrase that corresponds to the second time range in the transition model, and transmits the changed string information to the output unit 15. If the second time range does not exceed the first time range, the string manipulation unit 13 transmits the first time phrase to the output unit 15 without changing it.
[0022] For example, in FIG. 3, it is assumed that the first time phrase included in the character string information is "yesterday," the first date and time to which the character string information is assigned is "March 1, 2022," and the second date and time received by the input unit 12 is "April 1, 2022." In this case, the character string manipulation unit 13 calculates a difference value D between the first date and time, "30 days." The character string manipulation unit 13 also identifies a first time range T1 that is represented by the first time phrase "yesterday" in the transition model. In the transition model of FIG. 3, the first time range T1 that is represented by the first time phrase "yesterday" is defined as "one day" before the first date and time.
[0023] 3, the character string manipulation unit 13 identifies a second time range T2 in the transition model that includes the "31st" date, which is later than the first time range T1 by the difference value D of "30 days" and is before the first date and time. Since the second time range T2 is not included in the first time range T1 and is a time range that is later than the first time range T1 with respect to the first date and time, it can be said that the character string information including the first time phrase "yesterday" has become outdated over time at the input second date and time. In this case, the character string manipulation unit 13 changes the first time phrase "yesterday" to the second time phrase "last month," which corresponds to the second time range T2 in the transition model.
[0024] The time phrase storage unit 14 is a storage medium that stores the transition model. For example, a ROM, HDD, SSD, or a combination of these can be used as the time phrase storage unit 14. The character string storage unit 11 and the time phrase storage unit 14 may be configured as separate storage media, or may be configured as different databases in the same storage medium.
[0025] The output unit 15 receives the character string information from the character string manipulation unit 13 and outputs the received character string information.
[0026] (Processing performed by the string manipulation device) An example of the processing executed by the character string manipulation device will be described with reference to the flowchart of FIG.
[0027] First, in step S1, the input unit 12 receives information indicating a second date and time, which is an arbitrary date and time input by the user. The input unit 12 transmits the received information indicating the second date and time to the character string manipulation unit 13.
[0028] Proceeding to step S2, string manipulation unit 13 acquires string information and information indicating the first date and time at which the string information was assigned from string storage unit 11. Proceeding to step S3, string manipulation unit 13 calculates the difference between the first date and time and the second date and time.
[0029] Furthermore, in step S4, the character string manipulation unit 13 extracts, from the character string information, a time phrase (first time phrase) that is included in the character string information and expresses a temporal concept.
[0030] Proceeding to step S5, the string manipulation unit 13 identifies the first time range meant by the first time phrase in the transition model based on the first time phrase included in the string information and a transition model stored in the time phrase memory unit 14 that defines the time range meant by each of the multiple time phrases relative to the first date and time to which the string information is assigned.
[0031] Proceeding to step S6, the character string manipulation unit 13 identifies a second time range in the transition model that corresponds to the difference value calculated in step S3.
[0032] Proceeding to step S7, the character string manipulation unit 13 determines whether the second time range exceeds the first time range in the transition model. If the second time range exceeds the first time range (YES in step S7), the process proceeds to step S8. On the other hand, if the second time range exceeds the first time range (YES in step S7), the process proceeds to step S9.
[0033] In step S8, the character string manipulation unit 13 changes the first time phrase to a second time phrase corresponding to a second time range in the transition model, and then proceeds to step S9.
[0034] In step S9, the character string manipulation unit 13 transmits the character string information to the output unit 15. The output unit 15 outputs the character string information received from the character string manipulation unit 13.
[0035] (Action and effect) As described above, the string manipulation method by the string manipulation device 10 according to one embodiment acquires string information describing data and information indicating a first date and time to which the string information is assigned. Then, a difference between the first date and time and an arbitrary second date and time is calculated. Furthermore, the string manipulation method according to one embodiment extracts a first time phrase contained in the string information and expressing a temporal concept from the string information. Then, based on the first time phrase contained in the string information and a transition model stored in the time phrase storage unit 14, which defines a time range for the first date and time represented by each of a plurality of time phrases expressing a temporal concept, a first time range represented by the first time phrase is identified in the transition model. Furthermore, the string manipulation method according to one embodiment identifies a second time range in the transition model corresponding to a difference between the first date and time and the second date and time. Then, if the second time range exceeds the first time range, the first time phrase is changed to a second time phrase corresponding to the second time range in the transition model, and the string information is output.
[0036] According to one embodiment of the string manipulation method, when a second time range in a transition model corresponding to a difference between a first date and time when string information is assigned and an input second date and time exceeds the first time range indicated by a first time term included in the string information, the first time term is changed to a second time term corresponding to the second time range in the transition model based on the second time range corresponding to the difference in the transition model. Thus, when a first time term included in string information describing data becomes obsolete at an arbitrary second date and time, the string manipulation method according to one embodiment can change the first time term to a second time term corresponding to the second date and time based on the difference between the first date and time and the second date and time. Therefore, it is possible to prevent string information describing data from becoming obsolete over time.
[0037] Although the embodiments of the present invention have been described above, the descriptions and drawings that form part of this disclosure should not be understood to limit the present invention. Various alternative embodiments, examples, and operating techniques will become apparent to those skilled in the art from this disclosure.
[0038] For example, when changing a first time phrase to a second time phrase, the string manipulation device 10 according to one embodiment may update the first date and time included in the information indicating the first date and time stored in the string storage unit 11 to the second date and time.
[0039] For example, in FIG. 3, when the character string manipulation unit 13 changes the first time phrase "yesterday" to the second time phrase "last month" corresponding to the difference value D "30 days" in the inference model, the first date and time "March 1, 2022" stored in the character string storage unit 11 may be changed to the second date and time "April 1, 2022." In this case, if the present invention is applied again to, for example, "May 1, 2022," "April 1, 2022" becomes the first date and time, and "May 1, 2022" is treated as the second date and time. Furthermore, "last month" is treated as the first time phrase.
[0040] In this way, by updating the first date and time when updating the first time phrase, the string manipulation method by the string manipulation device 10 of one embodiment can repeatedly change the first time phrase to the second time phrase, thereby preventing the string information describing the data from becoming outdated over time.
[0041] Furthermore, the string manipulation device 10 according to an embodiment may count the number of times a first time phrase is changed to a second time phrase, and when the number of times the first time phrase is changed to a second time phrase is equal to or greater than a threshold, prohibit the change of the first time phrase and prohibit the output of string information. In this case, the string manipulation method by the string manipulation device 10 according to an embodiment can avoid outputting inaccurate string information including a first time phrase in which an error in the first time range meant by the first time phrase has accumulated due to repeated changes of the first time phrase included in the string information.
[0042] Furthermore, for example, in the string manipulation device 10 according to an embodiment, the transition model may define the relationship between the time ranges implied by each of the multiple time phrases and each of the objects described by the time phrases.
[0043] For example, the first time range implied by a first time phrase included in character string information varies depending on the object described by the first time phrase. For example, if the first time phrase is "latest" and the object described by the first phrase "latest" is "fashion," the first time range implied by the first time phrase is defined as "one year" before the first date and time. In contrast, if the object described by the first time phrase "latest" is "car," the first time range implied by the first time phrase "latest" is defined as "three years" before the first date and time.
[0044] In this case, the string manipulation device 10 identifies an object described by a first time phrase based on the string information, and identifies a first time range based on the first time phrase and a transition model corresponding to the identified object. The string manipulation device 10 also identifies a second time range corresponding to the difference value in the transition model corresponding to the identified object. Then, when the second time range exceeds the first time range, the string manipulation device 10 changes the first time phrase to a second time phrase corresponding to the second time range in the transition model corresponding to the identified object.
[0045] With the above configuration, the string manipulation method by the string manipulation device 10 according to one embodiment can appropriately change the first time phrase to the second time phrase depending on the object described by the first time phrase by changing the first time phrase to the second time phrase based on the difference value and the transition model corresponding to the identified object.
[0046] Furthermore, in the string manipulation device 10 according to an embodiment, the string storage unit 11 may further store related data, such as images, related to the string information. In this case, the string manipulation unit 13 further acquires related data related to the string information, and when identifying an object described by the first time phrase based on the string information, extracts attribute information of the object based on the related data. When the string manipulation unit 13 cannot identify the first time range defined by the first time phrase based on the first time phrase and the transition model corresponding to the identified object, it changes the first time phrase to a second time phrase based on the attribute information of the object.
[0047] For example, if the first time phrase included in the character string information is "current model" and the object described by the first time phrase "current model" is a "car," it is difficult to identify the first time range meant by the first time phrase "current model" using a transition model. In such a case, a character string manipulation method according to one embodiment extracts information about the car model as attribute information of the "car" described by the first time phrase "current model" based on associated data such as images related to the character string information. This allows the character string manipulation method according to one embodiment to determine whether the "car" is a current model that is still on sale or an older model that is no longer on sale. In a character string manipulation method according to one embodiment, if the "car" described by the first time phrase "current model" is a current model, the first time phrase "current model" is not changed. On the other hand, if the "car" described by the first time phrase "current model" is an older model, the first time phrase "current model" is changed to a second time phrase "older model."
[0048] With the above configuration, the string manipulation method by the string manipulation device 10 of one embodiment can appropriately change the first time phrase to the second time phrase depending on the object that the first time phrase describes, even if the period of the first time phrase cannot be identified from the first time phrase and the transition model contained in the string information.
[0049] Furthermore, the string manipulation device 10 according to an embodiment may change the first time phrase to information indicating a first date and time when the first time range indicated by the first time phrase is not defined by the transition model. In this case, when the first time range is not defined by the transition model, the string manipulation device 10 outputs string information in which the first time phrase has been changed to the first date and time. Therefore, according to the string manipulation method by the string manipulation device 10 according to an embodiment, even if the transition model defining the first time range indicated by the first time phrase is incomplete, it is possible to prevent string information describing data from becoming outdated over time. [Explanation of symbols]
[0050] 10 String manipulation device 11 Character string storage 12 Input section 13 Character string operation section 14 Time phrase memory section 15 Output section
Claims
1. A method for manipulating a string by a computer, comprising: The computer acquiring character string information describing the data and information indicating a first date and time when the character string information was added; Calculating a difference between the first date and time and an arbitrary second date and time; extracting a first time phrase expressing a temporal concept included in the character string information from the character string information; based on the first time phrase and a transition model that defines a time range for the first date and time that is meant by each of a plurality of time phrases expressing a temporal concept and that is stored in a storage unit, identifying a first time range that is meant by the first time phrase in the transition model; identifying a second time range in the transition model that corresponds to the difference value; When the second time range exceeds the first time range, the first time phrase is changed to a second time phrase corresponding to the second time range in the transition model, and the character string information is output. How to manipulate strings.
2. the transition model defines a relationship between each of the plurality of time expressions and the time range for each object described by the time expression; The computer Identifying an object described by the first time expression based on the character string information; Identifying the first time range based on the first time phrase and the transition model corresponding to the identified object; Identifying the second time range corresponding to the difference value in the transition model corresponding to the identified object; When the second time range exceeds the first time range, the first time phrase is changed to the second time phrase corresponding to the second time range in the transition model corresponding to the identified object. The method of manipulating a string according to claim 1 .
3. The computer further acquiring related data related to the character string information; extracting attribute information of the object based on the related data when identifying the object described by the first time phrase based on the character string information; When the first time range indicated by the first time phrase cannot be identified based on the first time phrase and the transition model corresponding to the identified target, changing the first time phrase to the second time phrase based on the attribute information of the target; The method of manipulating a string according to claim 2.
4. The computer When the first time phrase is changed to the second time phrase, the first date and time included in the information is updated to the second date and time. The character string manipulation method according to any one of claims 1 to 3.
5. The computer Counting the number of times the first time phrase is changed to the second time phrase; prohibiting a change to the first time phrase when the number of times is equal to or greater than a threshold; Prohibit output of the above character string information The character string manipulation method according to any one of claims 1 to 3.
6. The computer If the first time range is not defined by the transition model, the first time phrase is changed to information indicating the first date and time. The character string manipulation method according to any one of claims 1 to 3.
7. A character string manipulation device comprising: a character string manipulation unit that manipulates character string information that describes data; and an output unit that outputs the character string information, The character string manipulation unit acquiring character string information describing the data and information indicating a first date and time when the character string information was added; Calculating a difference between the first date and time and an arbitrary second date and time; extracting a first time phrase expressing a temporal concept included in the character string information from the character string information; based on the first time phrase and a transition model that defines a time range for the first date and time that is meant by each of a plurality of time phrases expressing a temporal concept and that is stored in a storage unit, identifying a first time range that is meant by the first time phrase in the transition model; identifying a second time range in the transition model that corresponds to the difference value; If the second time range exceeds the first time range, change the first time phrase to a second time phrase that corresponds to the second time range in the transition model. String manipulation device.
Citation Information
Patent Citations
Information display device, display method and mobile terminal
JP2011081577A