1 / 28

CS-5800 Theory of Computation II PROJECT PRESENTATION By Quincy Campbell &

CS-5800 Theory of Computation II PROJECT PRESENTATION By Quincy Campbell & Sandeep Ravikanti. Text Searching Conversion of Regular Expression to DFA and Use for Text Searching. Introduction. Text Searching , an application of Finite State automata concepts.

thu
Download Presentation

CS-5800 Theory of Computation II PROJECT PRESENTATION By Quincy Campbell &

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS-5800 Theory of Computation II PROJECT PRESENTATION By Quincy Campbell & Sandeep Ravikanti

  2. TextSearching Conversion of Regular Expression to DFA and Use for Text Searching.

  3. Introduction • Text Searching , an application of Finite State automata concepts. • A regular expression which is initially defined is parsed to DFA (Deterministic Finite Automata). • The obtained DFA is transformed to a transition table. • Thus the Scenario of Searching text is implemented with the help transition table.

  4. Regular Expression: • Regular expressions consist of constants and operator symbols that denote sets of strings and operations over these sets, which is therefore referred to as a regular set or language. • Let ∑ be an alphabet.The regular expression over ∑ are defined recursively • Basis :Ø,λ and a ,for every a €∑, are regular expressions over ∑. • Recursive Step: Let u and v be regular expressions over ∑. • (u U v) • (uv) • (u*) • These Expressions are regular expressions over ∑. • Closure: u is a regular expression over ∑ only if it can be obtained from the basis elements by a finite number of applications of recursive step.

  5. Deterministic Finite Automata: • Adeterministic finite automata M is a quintuple, (Q, Σ, δ, q0, F), consisting of • a finite set of states (Q) • a finite set of input symbols called the alphabet (Σ) • a transition function(δ : Q × Σ → Q) • a start state(q0 ∈ Q) • a set of accept states(F ⊆ Q)

  6. Text searching using a “*” Kleen Closure: Input String : (ab)* Output :Final State are “2”,”0” in transition table: Strings that can be obtained from the given expression {λ,ab, abab, ababab……etc.….}

  7. Kleen closure: Input String : a* Output :Final State are “2”,”0” in transition table: Strings that can be obtained from the given expression {λ,ab, abab, ababab……etc.….}

  8. Union “(a)+”: Input: Union Closure. Of a+” Output: Final States of “1” with transitions from aa

  9. Regular Expression With Parenthesis , Kleen Closure And Union Closure Input: ((ab)*(cd)+) with String “ When hug” Output: Final States would be “4” with No Matches for given String for searching.

  10. Issues: • Limitations of accessibility in handling transitions • Using of –closures operation for the Union operation is necessary. • An example for the expression which doesn’t work…

  11. New Approach Based on the limitations we had in the previous approach , we designed Text Searching with the Implementation of Thompson’s algorithm. Parsing of regular expression to NFA- Non Deterministic Finite Automata is done with the Thompson’s algorithm .The obtained NFA is converted DFA (Deterministic Finite Automata) with Subset Construction Algorithm. The generated DFA is formed into transition table and used for text Searching.

  12. THOMPSON’S ALGORITHM • The simplest method to convert a regular expression to a NFA is Thompson's Construction, also known as Thompson's Algorithm. Roughly speaking this works by reducing the regular expression to its smallest constituent regular expressions, converting these to NFA and then joining these NFA together. • Derives a nondeterministic finite automata (NFA) from any regular expression by splitting it into its constituent sub expressions, from which the NFA will be constructed using a set of rules

  13. Rules of Thompson’s Algorithm For a regular expression of a single symbol such as “b” resultant NFA would be as follows:

  14. For Union of regular expression “a|b:”

  15. For Kleen Star “(a|b)*”

  16. Final NFA: The NFA obtained after the application of rules of Thompson’s algorithm

  17. SUBSET CONSTRUCTION ALGORITHM: • Create the start state of the DFA by taking the Є-closure of the start state of the NFA. • Perform the following for the new DFA state: For each possible input symbol: • Apply move to the newly-created state and the input symbol; this will return a set of states. • Apply the  Є -closure to this set of states, possibly resulting in a new set. • This set of NFA states will be a single state in the DFA. • Each time we generate a new DFA state, we must apply step 2 to it. The process is complete when applying step 2 does not yield any new states. • The finish states of the DFA are those which contain any of the finish states of the NFA. • Example: If A, B and C are states, move({A,B,C},`a') = Move (A, ‘a’)  move(B, ‘a’)move(C, ‘a’).

  18. Considering an Example to perform Subset Construction Algorithm to generate DFA from the given NFA Given NFA

  19. Creating the Start State for DFA.by removing the epsilon closures

  20. The Final DFA : a q1 c q0 q3 c c b a c b q2 q0={1,3,5,7,8,9}start state q1={1,2,3,5,6,8,9} q2={1,3,4,5,6,8,9} q3={10} final state b

  21. Sample Output

  22. Conclusion: We finally conclude that the searching of text is implemented with achievement transition table of DFA for the given regular expression.

  23. References : Sudkamp A Thomas., Languages and Machines .Introduction to Theory of Computer Science Hop craft, J.E., and Ullman[1979],Introduction to automata theory ,Languages and Computation, Addison-Wesley, Reading ,MA https://class.coursera.org/automata/lecture/preview http://en.wikipedia.org/wiki/Thompson's_construction_algorithm

  24. Thank you

More Related