Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
StringTools[PatternDictionary][Create] - construct the dictionary
StringTools[PatternDictionary][Search] - search a string for occurrences of patterns in the dictionary
StringTools[PatternDictionary][Size] - return the number of patterns in the dictionary
StringTools[PatternDictionary][Get] - retrieve a pattern from the dictionary
StringTools[PatternDictionary][Factors] - factor a string over the dictionary
Calling Sequence
Create( patlist )
Search( dict, text )
Get( dict, id )
Size( dict )
Factors( s, dict )
type( expr, dictionary )
Parameters
dict
-
dictionary; dictionary object returned by Create
text
string; text to be searched
patlist
list of strings or the name builtin; patterns to search for
s
string; string to be factored
id
positive integer; index
expr
anything; Maple expression
Description
The PatternDictionary subpackage of the StringTools package provides for persistent multiple pattern matching. It maintains a search data structure for multiple patterns (called the dictionary), against which text strings may be searched. This allows you to handle the missing case in StringTools[Search] where there are multiple patterns and multiple texts. The PatternDictionary subpackage provides facilities for managing this list of patterns.
Five procedures are provided for managing and using the search patterns.
Create
The Create(patlist) command constructs the dictionary. The single argument patlist must be a list of strings, or the special name builtin. When invoked with the argument builtin, a small list of English and Maple words is used. This is intended primarily for system use, but is also available to users.
Note: The sets of patterns are not allowed as arguments to Create. This is because each pattern is associated with an unique ID that is used to identify it by its position in the pattern list. Thus, pattern lists are inherently ordered.
Search
When a dictionary is created, an external search data structure is created and used for subsequent searches using Search. The storage used for the search automaton is released when the dictionary object to which it is associated is garbage collected, a restart command is issued, or when the Maple process is terminated.
The Search(dict, text) command searchs a string text for occurrences of patterns in the dictionary dict. It returns an expression sequence of pairs of the form , where offset is positive integer giving the offset into text of the match it represents, and id is the index of the matching pattern in the current pattern list.
Size
The Size(dict) command returns the number of patterns in the dictionary dict as a Maple integer.
Get
Each pattern in a dictionary dict is associated with a unique, positive integral ID that identifies it uniquely within that dictionary. The pattern whose ID is id can be retrieved from the dictionary by using the Get(dict, id) command.
Factors
A string s can be factored over a dictionary dict by using the Factors(s, dict) command. It determines a sequence of strings in the dictionary that, when concatenated, form the input string s. Note that multiple factorizations are possible.
Examples
Error, (in aux) no factorization
You can replace the small built-in dictionary with a better word list.
Of course, many applications will not use English words.
See Also
SearchText, string, StringTools, StringTools[Search]
Download Help Document