Home » Other » Test » Re: How to obtain key words from the text?
Re: How to obtain key words from the text? [message #108649] Thu, 17 June 2004 00:14
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
Hi,

Not sure how SQL Server handles it, but in Oracle Text, you can use CTX_DOC.TOKENS() or CTX_QUERY.BROWSE_WORDS() to extract words from an Oracle Text index.

Here's a quick example:

SQL> CREATE TABLE docs (
  2          doc_id  NUMBER PRIMARY KEY,
  3          text    CLOB);
Table created.

SQL> INSERT INTO docs VALUES (1, 'Strings to be indexed');
1 row created.

SQL> INSERT INTO docs VALUES (2, 'Second document text');
1 row created.

SQL> COMMIT;
Commit complete.

SQL> CREATE INDEX docs_index ON docs(text) INDEXTYPE IS CTXSYS.CONTEXT;
Index created.

SQL> CREATE TABLE the_tokens (
  2          query_id NUMBER,
  3          token    VARCHAR2(64),
  4          offset   NUMBER,
  5          length   NUMBER);
Table created.

SQL> EXEC CTX_DOC.TOKENS('docs_index', '1', 'the_tokens', 1);
PL/SQL procedure successfully completed.

SQL> EXEC CTX_DOC.TOKENS('docs_index', '2', 'the_tokens', 2);
PL/SQL procedure successfully completed.

SQL> COL token FORMAT A30
SQL> SELECT * FROM the_tokens;

  QUERY_ID TOKEN                              OFFSET     LENGTH
---------- ------------------------------ ---------- ----------
         1 STRINGS                                 1          7
         1 INDEXED                                15          7
         2 SECOND                                  1          6
         2 DOCUMENT                                8          8
         2 TEXT                                   17          4


Best regards.

Frank
Previous Topic: Testing
Next Topic: Re: yyysdsa
Goto Forum:
  


Current Time: Thu Mar 28 15:10:12 CDT 2024