4.5 library(semweb/rdf_litindex): Indexing words in literals
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog Semantic Web Library 3.0
        • Plugin modules for rdf_db
          • library(semweb/rdf_litindex): Indexing words in literals
            • rdf_find_literals/2
            • rdf_token_expansions/2
            • rdf_tokenize_literal/2
            • Literal maps: Creating additional indices on literals
Availability::- use_module(library(semweb/rdf_litindex)).
Sourcerdf_token_expansions(+Spec, -Expansions)
Uses the same database as rdf_find_literals/2 to find possible expansions of Spec, i.e. which words‘sound like',‘have prefix', etc. Spec is a compound expression as in rdf_find_literals/2. Expansions is unified to a list of terms sounds(Like, Words), stem(Like, Words) or prefix(Prefix, Words). On compound expressions, only combinations that provide literals are returned. Below is an example after loading the ULAN2Unified List of Artist Names from the Getty Foundation. database and showing all words that sounds like‘rembrandt' and appear together in a literal with the word‘Rijn'. Finding this result from the 228,710 literals contained in ULAN requires 0.54 milliseconds (AMD 1600+).
?- rdf_token_expansions(and('Rijn', sounds(rembrandt)), L).

L = [sounds(rembrandt, ['Rambrandt', 'Reimbrant', 'Rembradt',
                        'Rembrand', 'Rembrandt', 'Rembrandtsz',
                        'Rembrant', 'Rembrants', 'Rijmbrand'])]

Here is another example, illustrating handling of diacritics:

?- rdf_token_expansions(case(cafe), L).

L = [case(cafe, [cafe, caf\'e])]