Free Essay

Automator

In:

Submitted By cosmosata
Words 1559
Pages 7
Application of Automata Theory
Automata theory plays an important role in so many vital areas. For instance; finite automata are used in text processing, compilers and hardware design.
Also context free grammar (CFGs) which was used in the study of the human language but now used in programming languages and artificial intelligence applies automata theory.
To add to the above automata theory is also applied to the field of biology. A common example is John Conway’s way of life. Some other examples of automata theory application to biology include mollusk and pine cones growth and pigmentation patterns.
However this study considers application of automata theory to text Search.
An Application: Text Search * Finding Strings in Text
Searching Google for a set of words is equivalent to just finding strings in documents. Finding strings in text has been a common problem in the age of the web and other online text repositories (i.e given a set words, find all documents that contain one or all of those words). A search engine (such as Google) is a typical example of this process. The technology used by these search engines is inverted indexes. Many applications are unsuited for inverted indexes because i. Indexes take space which may or may not be available ii. They take very large amount of time for crawlers (a program that collects online documents) to copy the web and set up the indexes. iii. And inverted indexes do not make use of finite automata

Applications that uses automaton based techniques for searches must have the following characteristics; i. The repository on which the search is conducted should be rapidly changing ii. The document to be searched cannot be catalogued.
Typical examples of the above characteristics is a news analyst who searches the days online news articles for relevant topics (i.e a financial analyst might search for the profit a specific company makes in a year) and amazon.com does not allow crawlers to find all the pages for all the books that the company sells respectively.

Nondeterministic finite automata for text search (NFA).
Assuming we are given a set of words which we shall call keywords and we want to find occurrences of any of these words. In such applications, it is useful to design a nondeterministic finite automaton which signals by entering an accepting state that it has seen one of the keywords. The text of a document is fed one character at a time to this NFA which then recognizes occurrences of the keyword in this text. A transition diagram implemented in an NFA is designed based on the following rules; i. There is a start state with a transition to itself on every input symbol. ii. For each keyword say a1 to an there are n states say s1 to sn i.e there is a transition from the start state to s1 on symbol a1 and so on. The state sn is an accepting state and indicates that keywords a1 to an has been found,

A simple example --- find the DFA equivalent to the following NFA which searches words of x1 = ab and x2 = b in long text strings a, b
2
Start b a, b
$20
4 a
1
a, b
$20
3 b a, b
2
Start b a, b
$20
4 a
1
a, b
$20
3 b Suppose we want to use an NFA to search for the two keywords ‘Web’ and ‘eBay’ among text

2 start 3 e
$20
4 b w
1
6
7
$20 8
5
e b a y

2 start 3 e
$20
4 b w
1
6
7
$20 8
5
e b a y

∑ = set of all printable ASCII characters
∑ = set of all printable ASCII characters

From the above transition diagram, * State 1 is the start state * ∑ stands for a set of all printable Ascii Characters * State 2 through to 4 have the job of recognizing the keyword web * State 5 through to 8 recognizes eBay How to implement an NFA i. Write a program that simulates the above NFA by computing a set of states it is in after reading each input symbol. ii. Convert NFA to equivalent DFA using the subset construction then simulate the DFA directly. Advanced forms of UNIX grep command (egrep and fgrep) are some text processing programs that uses a mixture of the two approaches above.

* DFA to Recognize a Set of Keywords The converted DFA has an equal number of states of the original NFA (an observation). The DFA states may be constructed using the following rules: a) If q0 is start state of NFA, then {q0} is start state of DFA b) If p is a state of NFA reachable (accessible) from a path x = a1a2…am, then one state of the DFA is a set of NFA states consisting of 1. q0 2. p 3. Every other NFA states reachable from q0 by following every sub path which is a suffix of x, like ajaj+1…am. In the above way, all states in the DFA may be constructed, and then all transitions derived. 


2
Start
3
e
$20
4 b w
1
6
7
$20 8
5
e b a y



2
Start
3 e
$20
4 b w
1
6
7
$20 8
5
e b a y

S
12
Start
3
e b w e b a y
135
1
16
17 18
15
S
146
S
12
Start
3
e b w e b a y
135
1
16
17 18
15
S
146

From the above state 3 of the NFA becomes state 135 of the DFA because * start state 1 is included; * state 3 itself is reachable by the path x=we, so state 3 itself is included; * x has a suffix e by which states 1 and 5 are reachable from start state 1.
How to derive transitions * For any state of the DFA of the form {q0, p1, p2, …, pn}, and for each input symbol x, let the reached states be {r1, r2, …, rm}, then the next state is {q0, r1, r2, …, rm}.

* If no ri as above can be collected, then if the reached states from the q0 by x are {s1, s2, …, sk}, then the next state is {q0, s1, s2, …, sk}.

An example


12
Start
3
e b w e b a y
135
1
16
17 18
15
146
12
Start
3
e b w e b a y
135
1
16
17 18
15
146




From the above (1) for x=b, state 34, state 56, so state 135146 (2) for x=e, state 3, state 5, but state 15, so state 13515

A complete NFA to DFA conversion is shown below (S b e w, e.g., means all ASCII characters other than b, e, w).

From the above diagram, each of the states of the DFA is located in the same position as the state p from which it is derived (using rule (b) above). For example, let’s consider the state 135 which is a shorthand for {1, 3, 5} was constructed from state 3. It includes a start state 1 because every set of the DFA states does.
It also includes state 5 because that state is reached from state 1 by a suffix ‘e’, of the string “we” that reaches state 3 in the figure above.
The transitions for each of the DFA states may be calculated according to the subset construction. However the rule is simple. From any set of states that include the start state qo and some other state {P1, P2, … Pn} determine, for each symbol x, where the Pi’s go in the NFA and let this DFA state have a transition labeled x to the DFA state consisting of qo and all the targets of the Pi’s on the symbol x.
On all symbols x such that there are no transitions out of any of the Pi’s on symbol x lets this DFA state have a transitions on x to that state of the DFA consisting of qo and all states that are reached from qo in the NFA following an arc labelled x.
For instance, state 135 of the figure above, the NFA has a transition on symbol b from states 3 and 5 to state 4 and 6 respectively.
Therefore on symbol b, 135 goes to 146. On symbol e, there are no transitions of the NFA out of 3 or 5 but there is a transitions from 1 to 5.
Thus in the DFA, 135 goes to 15 on input e and also on input w, 135 goes to 12.
On every other symbol x there are no transitions from 135 to 1 on every symbol in ∑ other than b, e and w. The notation ∑-b-e-w is used to represent this set and also a similar representation of other sets in which few symbols are removed from ∑,

References
1. Automata theory, https://www.princeton.edu/~achaney/tmve/wiki100k/docs/Automata_theory.html
2. John E. Hopcraf, Rajeev Motwani and Jeffery D Ullman in introduction to automata theory languages and computations.
3. Applications of automata theory, http://cs.stanford.edu/people/eroberts/courses/soco/projects/2004-05/automata-theory/apps.html
4. How practical is automata theory, http://cstheory.stackexchange.com/questions/8539/how-practical-is-automata-theory

Similar Documents

Free Essay

Asdf

...Apple’s Automator Workshop Dr. Lua nne F os e, I ns tr uc tor Ca l P ol y, T h e Center for T ea chi ng a nd Lear ni ng Background Apple has been trying to get people to program for a really long time. Apple introduced Apple Script, which was Apple’s attempt to make programming available to the masses but it failed miserably. Apple Script was really a programming language that wasn’t that easy to learn, and it wasn’t very powerful (because they were trying to make it easy to learn) so what you ended up with was a program that programmers didn’t want to use because it wasn’t flexible enough and real people didn’t want to use it because it wasn’t easy to learn. Apple Script is still around and much more powerful than it was in the past and much easier to learn than programming languages such as Basic or C. In an effort to bring programming to the masses, Apple has now introduced Automator. Basic Parts of the Interface Automator’s interface is similar to Apple’s Address Book or iTunes applications. You can select an application choice from the Library and see the set of Actions associated with it. If you click on an Action, you can see the description of what it does in the window below. You also have the choice to Run or Stop your actions with the Play and Stop buttons in the upper-right corner of Automator. This feature allows you to try out your Workflows why you are building them before you save them out as a plug-in or as an application. Create a Script to Convert...

Words: 1811 - Pages: 8

Premium Essay

Policy Planning

...Master Your Mac simple ways to tweak, customize, and secure os x MAT T CONE Master Your Mac Master Your Mac Simple Ways to Tweak, Customize, and Secure OS X MAT T CONE MASTER YOUR MAC. Copyright © 2013 by Matt Cone. All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. First printing 16 15 14 13 12 123456789 ISBN-10: 1-59327-406-8 ISBN-13: 978-1-59327-406-1 Publisher: William Pollock Production Editor: Serena Yang Cover Design: Serena Yang Cover Photo: Kazuya Minami Interior Design: Octopod Studios Developmental Editor: Tyler Ortman Technical Reviewer: Wayne Linder Copyeditor: Paula L. Fleming Compositor: Serena Yang Proofreader: Ward Webber Indexer: Nancy Guenther For information on book distributors or translations, please contact No Starch Press, Inc. directly: No Starch Press, Inc. 38 Ringold Street, San Francisco, CA 94103 phone: 415.863.9900; fax: 415.863.9950; info@nostarch.com; http://www.nostarch.com/ Library of Congress Cataloging-in-Publication Data A catalog record of this book is available from the Library of Congress. No Starch Press and the No Starch Press logo are registered trademarks of No Starch Press, Inc. My New is a trademark of No Starch Press, Inc. Other product and company names mentioned herein...

Words: 82954 - Pages: 332

Free Essay

Applescript

...Brief History The AppleScript project was a direct result of the HyperCard project. HyperCard was a hypermedia authoring environment that predated the World Wide Web. It featured an English language-based scripting language called Hyper Talk, which HyperCard programmers used to embed logic and behavior within a HyperCard stack. A HyperCard stack, by the way, was very much like a collection of Web pages, except that it all ran as part of a desktop application. You could create links and program buttons to perform certain actions. In many ways, HyperCard was an important forerunner of all the hypermedia projects and tools that followed, including CD-ROMs and the Web. In fact, the only thing that kept HyperCard from becoming the first Web browser was its focus on local stacks of cards, as opposed to network-oriented stacks. About AppleScript AppleScript is a scripting language that provides direct control of scriptable applications and scriptable parts of the Mac OS. A scriptable application is one that can respond to a variety of Apple events by performing operations or supplying data. An Apple event is a type of inter process message that can encapsulate commands and data of arbitrary complexity. By providing an API that supports these mechanisms, the “Open Scripting Architecture” makes possible one of the most powerful features in OS X the ability to write scripts that automate operations with multiple applications. AppleScript scripts can be used to perform repetitive...

Words: 2612 - Pages: 11

Premium Essay

5s and Poka Yoke Aplications

...5S and applications 5S may be the first step for the company to embrace Lean strategy. 5S stands for five different characters which are sort, set in order, shine, standardize, and sustain. The 5S system is a tool, or system that supports a philosophy of operating in an organized fashion. The philosophy that this system supports is one of discipline, efficiency, and attention to detail (Graban, 2009). The idea behind 5S is that if a workplace is clean and well laid out, the identification of waste is much easier (Sarkar, 2005). 5S is a way to help the company to reduce the waste and enhance possible profits. 5S is used by five different Japanese words which are seiri, seiton, seiso, seiketsu and shitsuke and these focus on effective workplace and work procedure (Graban, 2009). Seiri, which is sort in English, helps the company or any organization to distinguish the items into two different categories: used and non-used (Breyfogle,2010). Seiton means set in order and it is focusing on making efficiency in the workplace by rearranging all items in the company which will promote work flow. All the tools should be set in the place where can improve work flow and it is easy to find for job (BusinessKnowledgeSource.com, paragraph 4, 2010). Seiso means to clean and clear. This step focuses on cleaning and clearing any item and working environment (The 5S plan Lean manufacturing solution, 2008). Seiketsu means standardize. To keep the first three Ss as the standard all the time and...

Words: 3396 - Pages: 14

Free Essay

Adwords Study Guide

...AdWords Study Guide Chapter 1: Introduction to AdWords Chapter 2: Getting Started with AdWords Chapter 3: Targeting Chapter 4: Costs and Billing Chapter 5: Tracking Ad Performance Chapter 6: Optimizing Ad Performance Chapter 7: Account Performance Tools Chapter 8: Google Analytics Chapter 9: Managing Client Accounts 2 5 8 11 13 16 18 20 22 AdWords Study Guide © Naper Solutions, Inc 1 Chapter 1 Introduction to AdWords AdWords Basics Google and Google AdWords Google is a search engine Google uses keyword based advertising to target your ads to users searching for your product or service The text ad headline is limited to 25 characters (including spaces) Basic AdWords Features The CTR helps determine whether your ad is effective If you elect to show your ads on the Google content network, your ads will be eligible to show on websites that contain content related to your ad. Google ads can be targeted to any language or location available worldwide. Benefits of AdWords There is no minimum spending limit with Google AdWords AdWords allows an unlimited amount of changes to an account per month Google Ads appear primarily on the right hand side of the screen or above the search results and are titled “sponsored links” Your ads will appear when a user’s search query includes a keyword that is part of your ad campaign You control the budget for your advertising campaign. You can set a daily budget and Google will stop showing your ad when you reach the daily limit....

Words: 8548 - Pages: 35

Free Essay

Archicad Step by Step

...Contents Contents Step by Step Tutorial by Thomas M. Simmons 1ArchiCAD Step by Step Tutorial ArchiCAD Step by Step Tutorial1 Contents Graphisoft Visit the Graphisoft website at http://www.graphisoft.com for local distributor and product availability information. Graphisoft ArchiCAD Step by Step Tutorial Copyright © 1998-2003 by Thomas M. Simmons. All rights reserved. Reproduction, paraphrasing or translation without express prior written permission of the author and Graphisoft is strictly prohibited. Published by GRAPHISOFT R&D Rt. Second edition - first printing. Trademarks ArchiCAD and ArchiFM are registered trademarks and PlotMaker, Virtual Building, StairMaker and GDL are trademarks of Graphisoft. All other trademarks are the property of their respective holders. 2 ArchiCAD Step by Step Tutorial Contents Contents About the Author Thomas M. Simmons President ARCHVISTA The Graphisoft ArchiCAD Step by Step Tutorial was developed by ARCHVISTA and used with the ArchiCAD training course at the San Francisco Institute of Architects. This is the first edition of Step by Step produced for ArchiCAD 8. The author, Thomas M. Simmons, spent seven years as an architect and served as the Director of Design Technology for Esherick, Homsey, Dodge and Davis Architects, an award-winning and internationally acclaimed architecture firm, before starting his company, ARCHVISTA. While at EHDD Architects, he was instrumental in integrating and managing ArchiCAD...

Words: 31008 - Pages: 125

Premium Essay

Scp and Sap Apo

...Supply Chain Management and Advanced Planning Hartmut Stadtler ´ Christoph Kilger (Eds.) Supply Chain Management and Advanced Planning Concepts, Models, Software and Case Studies Third Edition With 173 Figures and 56 Tables 12 Professor Dr. Hartmut Stadtler FG Produktion und Supply Chain Management FB Rechts- und Wirtschaftswissenschaften TU Darmstadt Hochschulstraûe 1 64289 Darmstadt Germany stadtler@bwl.tu-darmstadt.de Dr. Christoph Kilger j&m Management Consulting AG Kaiserringforum Willy-Brandt-Platz 5 68161 Mannheim Germany christoph.kilger@jnm.de Cataloging-in-Publication Data Library of Congress Control Number: 2004110194 ISBN 3-540-22065-8 Springer Berlin Heidelberg New York ISBN 3-540-43450-X 2nd edition Springer Berlin Heidelberg New York This work is subject to copyright. All rights are reserved, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilm or in any other way, and storage in data banks. Duplication of this publication or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965, in its current version, and permission for use must always be obtained from Springer-Verlag. Violations are liable for prosecution under the German Copyright Law. Springer is a part of Springer Science+Business Media springeronline.com ° Springer Berlin ´ Heidelberg 2000, 2002, 2005 Printed...

Words: 180845 - Pages: 724