Download Maple Advanced Programming Guide

Transcript
2.7 Extended Example: A Search Engine
•
159
´
µ ´
µ
1 0
0 1
{
,
}
0 1
1 0
Exercises
1. An automorphism α of a group G is called inner if there is an element
a in G for which α(g) = a−1 ga, for all g in G. Write a constructor for
inner automorphisms of groups.
Summary With generic programming you need only implement computation in quotient fields or groups once — in the constructors and generic
procedures. The functor QuotientField and the various generic group
constructors and procedures are parameterized by the computational domains upon which their computed values depend. Rings, fields, groups,
and subgroups are collections of computational capabilities, which you
use to construct new instances with derived computational capabilities.
Overriding default methods (which may not be efficient, but are always
present) with methods that take advantage of specific structural information allows for efficient computation without sacrificing generality. This
leads to a powerful paradigm for software reuse, and is the principal motivation underlying the Maple module system.
2.7
Extended Example: A Search Engine
Search engines are used in a variety of contexts to locate documents that
match or satisfy a query. Queries consist of sequences of search terms
– words that are meant to prescribe the subject matter of matching
documents. Examples of search engines include Web search engines and
database interfaces. However, search engines can be adapted to search a
wide variety of structured or unstructured data.
This example illustrates how a simple search engine, based on the vector space model, can be constructed using Maple. Various Maple packages
are used to pre- and post-process the data to be searched, as well as the
queries, and the LinearAlgebra package is used to effect the computations necessary to locate relevant documents.
Introduction to Searching
Prototypically, a document is a file of structured or unstructured text, but
this section treats documents as abstract data items. A document can be