Hostname: page-component-74656f9884-j7cmm Total loading time: 0 Render date: 2026-11-05T17:33:22.255Z Has data issue: false hasContentIssue false

Efficient dictionary-based text rewriting using subsequential transducers†

Published online by Cambridge University Press:  01 December 2007

S. MIHOV
Affiliation:
Institute for Parallel Processing, Bulgarian Academy of Sciences, Bulgaria e-mail: stoyan@lml.bas.bg
K. U. SCHULZ
Affiliation:
CIS, University of Munich, Munich, Germany e-mail: schulz@cis.uni-muenchen.de
Rights & Permissions [Opens in a new window]

Abstract

Problems in the area of text and document processing can often be described as text rewriting tasks: given an input text, produce a new text by applying some fixed set of rewriting rules. In its simplest form, a rewriting rule is given by a pair of strings, representing a source string (the “original”) and its substitute. By a rewriting dictionary, we mean a finite list of such pairs; dictionary-based text rewriting means to replace in an input text occurrences of originals by their substitutes. We present an efficient method for constructing, given a rewriting dictionary D, a subsequential transducer that accepts any text t as input and outputs the intended rewriting result under the so-called “leftmost-longest match” replacement with skips, t'. The time needed to compute the transducer is linear in the size of the input dictionary. Given the transducer, any text t of length |t| is rewritten in a deterministic manner in time O(|t|+|t'|), where t' denotes the resulting output text. Hence the resulting rewriting mechanism is very efficient. As a second advantage, using standard tools, the transducer can be directly composed with other transducers to efficiently solve more complex rewriting tasks in a single processing step.

Information

Type
Papers
Copyright
Copyright © Cambridge University Press 2007
Figure 0

Fig. 1. Subsequential transducer trie for the rewriting dictionary D introduced in Example 2.4.

Figure 1

Fig. 2. Scanning a string αq representing a prefix of an entry of D.

Figure 2

Fig. 3. Construction of the subsequential transducer for the canonical lmls extension of the dictionary given in Example 2.4. Situation after states q0 = p1,. . . p6 have been visited.

Figure 3

Fig. 4. The subsequential transducer for the canonical lmls extension of the dictionary given in Example 2.4.

Figure 4

Fig. 5. Scanning substring αq·σ.

Figure 5

Fig. 6. The subsequential transducer for the canonical lmls-extension of the dictionary given in Example 6.1.

Figure 6

Fig. 7. The subsequential transducer for the canonical lmls-extension of the dictionary given in Example 6.1 with the pointer-based representation of output functions.

Figure 7

Fig. 8. Calculation of a triple from the predecessor triple.

Figure 8

Table 1. Results for text rewriting using random rewriting dictionaries, speed-up factors (ratio of times) w.r.t. naïve algorithm