Oracle Text Application Developer's Guide Release 9.0.1 Part Number A90122-01 |
|
Document Presentation, 3 of 3
The following table describes list of themes, gists, and theme summaries.
To obtain this output, you use procedures in the CTX_DOC supplied package. With this package, you can do the following:
A list of themes is a list of the main concepts in a document. Use the CTX_DOC.THEMES procedure to generate lists of themes.
The following example generates the top 10 themes for document 1 and stores them in an in-memory table called the_themes
. The example then loops through the table to display the document themes.
declare the_themes ctx_doc.theme_tab; begin ctx_doc.themes('myindex','1',the_themes, numthemes=>10); for i in 1..the_themes.count loop dbms_output.put_line(the_themes(i).theme||':'||the_themes(i).weight); end loop; end;
To create a theme table:
create table ctx_themes (query_id number, theme varchar2(2000), weight number);
To obtain a list of themes where each element in the list is a single theme, issue:
begin ctx_doc.themes('newsindex',34,'CTX_THEMES',1,full_themes => FALSE); end;
To obtain a list of themes where each element in the list is a hierarchical list of parent themes, issue:
begin ctx_doc.themes('newsindex',34,'CTX_THEMES',1,full_themes => TRUE); end;
A gist is the text of a document that best represents what the document is about as a whole. A theme summary is the text of a document that best represents a single theme in the document.
Use the procedure CTX_DOC.GIST to generate gists and theme summaries. You can specify the size of the gist or theme summary when you call the procedure.
The following example generates a non-default size generic gist of at most 10 paragraphs. The result is stored in memory in a CLOB locator. The code then de-allocates the returned CLOB locator after using it.
declare gklob clob; amt number := 40; line varchar2(80); begin ctx_doc.gist('newsindex','34','gklob',1,glevel => 'P',pov => 'GENERIC', numParagraphs => 10); -- gklob is NULL when passed-in, so ctx-doc.gist will allocate a temporary -- CLOB for us and place the results there. dbms_lob.read(gklob, amt, 1, line); dbms_output.put_line('FIRST 40 CHARS ARE:'||line); -- have to de-allocate the temp lob dbms_lob.freetemporary(gklob); end;
To create a gist table:
create table ctx_gist (query_id number, pov varchar2(80), gist CLOB);
The following example returns a default sized paragraph level gist for document 34:
begin ctx_doc.gist('newsindex',34,'CTX_GIST',1,'PARAGRAPH', pov =>'GENERIC'); end;
The following example generates a non-default size gist of ten paragraphs:
begin ctx_doc.gist('newsindex',34,'CTX_GIST',1,'PARAGRAPH', pov =>'GENERIC', numParagraphs => 10); end;
The following example generates a gist whose number of paragraphs is ten percent of the total paragraphs in document:
begin ctx_doc.gist('newsindex',34,'CTX_GIST',1, 'PARAGRAPH', pov =>'GENERIC', maxPercent => 10); end;
The following example returns a theme summary on the theme of insects for document with textkey 34. The default Gist size is returned.
begin ctx_doc.gist('newsindex',34,'CTX_GIST',1, 'PARAGRAPH', pov => 'insects'); end;
|
Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|