Character matching in text processing
AssigneeInternational Business Machines Corporation
InventorsGregory Brodsky, Tomer Mahlin
Life of this patent
Estimating the term…
Abstract
A structured query language (SQL) query can contain a target text comprising respective characters in un-shaped format (also known as base format). The target text can be shaped according to the position of respective characters within the target text and other factors to generate a plurality of shaped target texts. The plurality of shaped target texts can be combined in a modified SQL query. The modified SQL query can be executed against one or more databases storing text in shaped format.
Claims20
A method comprising:
- determining an original structured query language (SQL) database query comprises a query clause containing a string of un-shaped characters in Arabic, wherein each of the un-shaped characters are associated with a plurality of respective shapes based on a respective location of respective un-shaped characters in a word, wherein the plurality of respective shapes comprise an initial position, a middle position, a final position, and an isolated position, and wherein the string comprises a first wildcard operator, a first character, a second character, and a third character;
- generating a plurality of respective generated query clauses storing respective shapings of the string of one or more un-shaped characters therein, wherein the plurality of respective generated query clauses comprises:
- a first query clause comprising the first character in the initial position, the second character in the middle position, and the third character in the final position;
- a second query clause comprising the first character in the middle position, the second character in the middle position, and the third character in the final position;
- and
- a third query clause comprising the first character in the isolated position, the second character in the isolated position, and the third character in the isolated position;
- combining respective generated query clauses storing respective shapings of the string of characters therein to create a modified SQL database query;
- outputting the modified SQL database query to a processor configured to execute the modified SQL database query against a database;
- and
- presenting search results from the modified SQL database query to a user interface.
A system comprising:
- a database comprising Arabic text stored in shaped format, wherein shaped format comprises an initial position, a middle position, a final position, and an isolated position for respective Arabic characters;
- a user interface configured to receive an original structured query language (SQL) query comprising a function including a LIKE clause having a target text comprising Arabic characters in un-shaped format stored therein, wherein the target text comprises a first wildcard operator, a first character, a second character, and a third character;
- a repository containing language shaping rules;
- and
- a processor communicatively coupled to the user interface, the repository, and the database, and configured to:
- receive the original SQL query from the user interface;
- generate a plurality of respective generated LIKE clauses storing respective shaped target texts therein corresponding to respective shapings of the target text in un-shaped format, wherein the plurality of respective generated LIKE clauses comprises:
- a first query clause comprising the first character in the initial position, the second character in the middle position, and the third character in the final position;
- a second query clause comprising the first character in the middle position, the second character in the middle position, and the third character in the final position;
- and
- a third query clause comprising the first character in the isolated position, the second character in the isolated position, and the third character in the isolated position;
- create a modified SQL query based on the plurality of respective generated LIKE clauses;
- execute the modified SQL query on a database;
- and
- present, to the user interface, portions of the data in the database according to the modified SQL query.
A computer program product comprising a computer readable storage medium having program instructions embodied therewith, wherein the computer readable storage medium does not comprise a transitory signal per se, wherein the program instructions are executable by a processor to cause the processor to perform a method comprising:
- receiving an original structured query language (SQL) query comprising a function and a LIKE clause containing an original target text including Arabic text in un-shaped format, wherein the LIKE clause is configured to match text from a database storing Arabic text in shaped format to the original target text, wherein shaped format comprises an initial position, a middle position, a final position, and an isolated position for respective Arabic characters, wherein the original target text comprises a first wildcard operator, a first character, a second character, and a third character;
- generating a plurality of respective shaped target texts based on the original target text and the first wildcard operator, wherein the plurality of respective shaped target texts comprises:
- a first query clause comprising the first character in the initial position, the second character in the middle position, and the third character in the final position;
- a second query clause comprising the first character in the middle position, the second character in the middle position, and the third character in the final position;
- and
- a third query clause comprising the first character in the isolated position, the second character in the isolated position, and the third character in the isolated position;
- combining the plurality of respective shaped target texts to create a modified SQL query;
- storing the modified SQL query in the computer readable storage medium;
- executing the modified SQL query on the database storing Arabic text in shaped format;
- and
- presenting, to a user interface, portions of the database matching the modified SQL query.
Dependencies are inferred from the claim text.