السلام عليكم...
يا جماعة عندي مشروع مطلوب مني تسليم ADT للمشروع بعد اسبوعين وبعد ذلك باسبوعين ايضا يتم تسليم المشروع والبرنامج كامل بلغة سي..
المشكله انه صار لي فتره ماني عارف كيف أبدأ بالمشروع ابداً يعني المشروع وهدفه بالنسبه لي واضح..لكن ما ادري كيف أبدأ ولا الخطوات اللي بتسهل علي الحل.. أرجوكم يا جماعة ساعدوني في الحل.. المشروع كتبته وأضفته هنا باللغة الانجليزية.. وإذا في أي سؤال مش واضح ارجو انكم تستفسروا عنه.. بصراحه يا جماعة المشروع هذا عقبة لحد الان امام 133 طالب أرجو منكم المساعده وانكم تدلونا على اول الطريق واتركوا لنا الباقي.. مابي اطول كلام.. وهذا المشروع بين اياديكم.. واتمنى انه يكون واضح ومفهوم وفكرته سهله التعامل..
SMART AND POWERFUL SEARCH
INTRODUTION
The main objective of this project is implement a powerful meta-language which permits a compact way of describing complex search patterns in the text. As an example, suppose that someone named: Ahmed Mohammad Omar and we have to find this name (with all possible combination) in a list. Using our Smart and Powerful Search (SPS) if we use the pattern:
(Ahmed | A . ) ? ( Mohammad | . ) ? Omar
The above pattern means: pick a string the first of which is either "Ahmed" or "A." followed by an optional single space after which is either "Mohammed" or "M." (both optional) a single space and then "Omar". It will catch all the following variations: A. Omar, A.M. Omar, A. M. Omar, Ahmed Omar, Ahmed M. Omar, A. Mohammad Omar, and Ahmed Mohammad Omar.
Another example, consider the pattern:
[A-Za-z0-9_ ]+@([A-Za-z_ ]+.){2,3}(com | edu | net | gov) .sa
This powerful pattern will match most of the valid email addresses in Saudi Arabia. I would like rather skip describing how to write such an expression but it dose serve showing the power behind such.
Now back to our project. The aim is to write a program SPS which accepts two inputs. The input is the pattern to match (written using the meta-language and input though command line argument), and second the file to operate on. The SPS will output all the matching lines highlighting the matched text.
Operations
Your SPS program will recognize the following symbols
1. The Wildcard Symbol
The "." symbol matches a single occurrence of any character (except newline). For example: s . n matches the following English words: sun, sin, san, and many others which may not make sense such as sbn, scn, .. .. Similarly the pattern: …ing matches six-letter words that end with ing.
2. The Optionality Symbol
The symbol "?" indicates that the immediately preceding expression is optional. The expression colou?r matches both Britich and American spellings, colour and color.
3. The Symbol for repeatability
There are two symbol that indicate that the immediately preceding expression is repeatable. The "+" symbol indicate repeatability of >= 1 times , while "*" indicates repeatability of >=0 times. Example, ba+b matches the bab, baab, baaab, …
4. The grouping symbol
The symbol "(…)" groups a series of patter element to single element. We can combine this symbol with our symbols of optionality or repeatability. For example, expression a(bc)?d matches the words: ad, and abcd. While the expression a(bc)*d matches the words: ad, abcd, abcbcd, abcbcbcd,…
5. Choices
Wildcard symbol is very effective but there are times when we want to limit the set of character which the wildcard can match. There are four different ways of expressing choices:
• The "[…]" notation which denotes a class of characters to match. For example, the expression p[aou]t matches the words: pat, pot, and put. In case the characters in the class are contiguous then we write it using a hyphen between the first and last character in the class. The expression [ b – e ]x matches bx, cx, dx, and ex.
• The "[^…]"notation that negates the class of characters to match. For example, p[^a – c]x matches the words: pdx, …, pxx, pAx, pBx, …,pOx, p1x, …i.e matches any word with p followed by any character other than a, b, or c then x.
• The notation "(…|…|…)" matches one of the alternatives. Consider for example the pattern, Ahmad ( Ali| Abbas ) Ziad matches the names: Ahmed Ali Ziad, or Ahmad Abbas Zaid.
And as with grouping, we can combine the choices with symbols of optionality or repeatability. The expression p[aou]+t matches: pat, paut, puat, puoat, … while a ( bc | de )*f matches: af, abcf, adef, abcdef, abcbcdebcf, …
6. Matching Meta Chars
each character matches itself, unless it is one of the above special symbols. To match any of these special symbols you need to add "" before it. For example, [ abc+]
will match [abc], [abcc],…
some notes: the algorithm should be smart enough to handle some of the mare awkward cases. Consider the expression ab*ba, it should matches: bab, baab, baaab, … Another example a (bc) + (bc) *d must match:abcd, abcbcd, …