How do i read a question in javacc and be able to identify key tokens
hello everyone....
I need help. I am still new with javacc, i am trying to generate a parser that will accept a question and be able to recognise the keywords and the askword from the question. e.g a question like "what is HIV" . it is suppose to get "what" as the askword and "HIV" as the key
another example: "what are arv drug" "what" as the askword and "arv drug" as the key
below is the code for what i have done so far.... thanx in advance
Code:
PARSER_BEGIN(SMS_QUERY)
import java.io.StringReader;
public class SMS_QUERY {
public static void main(String args[]) throws ParseException{
SMS_QUESTION q = new SMS_QUESTION(System.in);
q.QUESTION();
System.out.println(q);
PARSER_END(SMS_QUERY)
SKIP :
| "\t"
| "\n"
| "\r"
void SMS_QUESTION() : {}
(NounPhrase())+ | AskWord() | AskWord() (NounPhrase())+ | <EOF>
void AskWord() : {}
Awhat()
void Awhat() : {}
"what" | "wht" | "wt" | "wyt" | "vat" | "wat"
void NounPhrase() : {}
key()
void key() : {}
q1key() | q2key() | q3key()
void q1key() : {}
"Arv" | "Arv Drugs" | "Arv drgs" | "Arv drgh"
void q2key() : {}
"HIV" | "Hi virus"
}
This not a javacc forum. Locking.
Similar Messages
-
How do I read text from specific rows and columns in a tree structure?
How do I read text from specific rows and columns in a tree structure? In a table you can specify the cell to read from but I have not been able to figure out how to do this with a tree structure.
You need to set two properties to activate the correct cell and then you can read it's string property.
The positioning properties are the "ActiveItemTag" and
"ActiveColNum" properties. With them you select the tree item by it's tag and the active column. The string can then be read from the "Cell String" property.
MTO -
How do you save your photos in iPhoto and be able to find the photos when you are in different programs. When i try to find them I can only find the iPhotos not the individual photos.
Use the media browser. In every open/attach window in tithe lower left hand corner under media ==> photos ==> iPhoto
LN -
How can i do to see the master and text values of the Key figure 0UNIT
Hi gurus,
How can i do to see the master and text values of the Key figure 0UNIT, please step by step, i m in the key figure 0UNIT but i want to see if the UNIT for example BX = BOX, something like this is that i want to check, thanks!If you look at the unit tables, you will see the values and texts. It's in SPRO, not in RSA1. My access is limited on my system here, but the documentation says to go to t-code CUNI. I believe in that tcode you can look at all of the unit equivalencies and what each unit's text is ..... like an ea means each; KG = Kilogram; etc...
I am on an 3.x system, so in SPRO I go to BW CIG=>General Settings=>Check units of measurement.
Brian -
How can I make my question slide look and act like the rest of the project?
Hi,
I have created my project without using a template. Each time I needed to create a new screen I simply duplicated the slide and then inserted new text. This worked quite well. However, when I tried to do this for a question slide, it wouldn't let me (obviously).
Is there a way of customising a question slide to look exactly like the rest of my project (and have the interactivity on the slide that the rest of the project has)? When I tried designing a new template and question template side and applying it to the question slide in my project, I could only insert a static image as the background on the template slide. Needless to say, there was no interactivity on the slide, i.e. no active click boxes etc, and I couldn't add these either when I applied it to the slide.
Any help is much appreciated. This is for a Masters project, so I'm still learning the basics.
Thanks.Hi Lilybiri,
I am using Captivate 4. All of my screens so far look like a website - with menus and makeshift spry menus (image maps with click boxes). My preference is to use this layout for the question slides. However, it sounds like this isn't possible. What do other people do to make their question slides look a part of the course?
Thanks. -
How to re-read a spool, modify it and re-saving the spool.
Hi Experts,
Can any tell me how to re-read a spool out of spool system, modifying the output and re-saving the spool.
I need to replace the total no. of pages count on every page of the spool. It is the list format.
Thanks in Advance.
Govind Parmar.Hi
Do u want tot retrieve the data of spool?? If so then check it out
Read Temse data from UNIX filesystem and display. You must reconstruct the relationship between Temse tables and the spool files (tables TST01 and TSP01) for this to work. Dname, Rqident, Dsize are the important fields. This was used to retreive deleted spool output pertaining to an important project. Spool cleanup job RSPO0041 deleted the spool files regardless of the Delete after date
<u><b>
Procedure :</b>
</u>
Restore the spool files (assuming you employ spool_method G and also backup /sapmnt/SID/global/xxxSPOOL directory) in a temp. directory and rename them to numbers which will not overwrite the existing max(dname) in TST01.
Using ABAP or SQL copy in the same table, a row from both TST01 and TSP01 and update TST01:Dname (spool name), TST01:Dsize (size of the spool file in bytes) and TSP01:Rqident (spool number)
REPORT ZREADSP.
PARAMETERS: ZNAME(6).
DATA: HAND4(28) TYPE X,
LN TYPE I,
LN2 LIKE RSTSTYPE-LINELENGTH,
BUFFER(132),
RSTSRC(6),
ERRMSG(50),
HIDE_CLIENT LIKE TST01-DCLIENT VALUE '200',
HIDE_NAME LIKE TST01-DNAME ,
HIDE_PART LIKE TST01-DPART VALUE '1',
FULL_NAME(40).
DATA:BEGIN OF BUFTAB OCCURS 1002,
TXT(8000),
END OF BUFTAB.
CONCATENATE 'SPOOL' ZNAME INTO HIDE_NAME.
CALL 'C_RSTS_OPEN_READ' ID 'HANDLE' FIELD HAND4
ID 'CLIENT' FIELD HIDE_CLIENT
ID 'NAME' FIELD HIDE_NAME
ID 'PART' FIELD HIDE_PART
ID 'RC' FIELD RSTSRC
ID 'ERRMSG' FIELD ERRMSG.
CALL 'C_RSTS_READ' ID 'HANDLE' FIELD HAND4
ID 'BUFTAB' FIELD BUFTAB-*SYS*
ID 'MAXIX' FIELD 10000
ID 'RC' FIELD RSTSRC
ID 'ERRMSG' FIELD ERRMSG.
CALL FUNCTION 'RSPO_SPOOLDATA_WRITE_INIT'.
LOOP AT BUFTAB.
LN = STRLEN( BUFTAB-TXT ).
IF LN > 0.
LN2 = LN.
CALL FUNCTION 'RSPO_SPOOLDATA_WRITE'
EXPORTING
SPOOL_DATA = BUFTAB-TXT
DATA_LENGTH = LN2
EXCEPTIONS
DATA_TOO_SHORT = 1
OTHERS = 2.
ELSE.
SKIP.
ENDIF.
ENDLOOP.
<u></u>
Regards
Pavan -
How can I read two channels with fieldpoint and labview
I'm trying to read two or more channels with the TC 120, and I follow the examples of sopport page, but doesn't work.
What can I do?For more information about reading or writing to or from multiple channels in Fieldpoint, please refer to:
How Do I Read or Write to Multiple Channels on a Fieldpoint Module in LabVIEW?
This should enable you to read multiple channels. The only other option available is to use one fp open.vi, multiple Create Tag.vi's and multiple FP Tag Read.vi's. -
How to change an "answered question" icon to and "open" one
An hour ago this morning, I re-opened a thread of mine that had already been answered. Unfortunately, I could not easily locate the instruction or button that allows me to convert the "answered question" icon to an "open question" icon. I want to change it so those people who filter their screens to view only "open question" posts will find mine.
Please advise if this can be done. If so, how can it be done?
Thanks, in advance.Unless the question is the identical question, please open a new discussion topic. Otherwise, you will present us with a long chain of discussion to wade through to find your new question, and I know I for one...if I think I've already worked through a questions...don't want to wade through it again.
If it is indeed the same question, it is not as clear. It must be the IDENTICAL problem or situation you are facing to "reuse" a thread.
I recommend...especially if you are at all on a different tangent...referring to your earlier thread with a link. State your new question clearly in the title, and present your case succinctly, with links.
What sort of efficiency are you trying to achieve by reopening a question that has been "answered?" If you have already marked responses as helpful or as answers, there's very little pay for considering your reopened question. (joke) Help the Forum economy by opening a new thread!
Beth -
Read 100 Question OMR Sheet and Show result
Hello All,
I got a Project from:
http://www.codeproject.com/Articles/451169/Csharp-Optical-Marks-Recognition-OMR-Engine-1-0?msg=4386396#xx4386396xx
thanks to umar.techBOY.
I changed it to my requirment as 100 Questions with 4 Options in A4 size Paper.
Its working fine as far as read registration is concern.
The problem with the read Answer Function.
The code for reading Answer are as follows:
private void button7_Click(object sender, EventArgs e)
//ContrastCorrection cc = new ContrastCorrection();
//panel1.BackgroundImage = cc.Apply((Bitmap)panel1.BackgroundImage);
panel1.Invalidate(); Application.DoEvents();
showTimeStamp("Slicing Started");
Rectangle[] Blocks = new Rectangle[]
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock1),
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock2),
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock3),
OMRSheetReader.GetSheetPropertyLocation("sheets", OMREnums.OMRSheet.A450, OMREnums.OMRProperty.tensBlock4)
List<Bitmap[]> bmps = new List<Bitmap[]>();
for (int i = 0; i < 4; i++)
bmps.Add(SliceOMarkBlock(panel1.BackgroundImage, Blocks[i], 25));
showTimeStamp("Slicing ended");
string ans = "";
foreach (Bitmap[] blk in bmps)
foreach (Bitmap line in blk)
ans += rateSlice(line,25) + ",";
ans += "\r\n";
panel1.Invalidate();
Application.DoEvents();
MessageBox.Show(ans);
private int rateSlice(Bitmap slice, int OMCount)
Rectangle[] cropRects = new Rectangle[OMCount];
Bitmap[] marks = new Bitmap[OMCount];
for (int i = 0; i < OMCount; i++)
cropRects[i] = new Rectangle(i * slice.Width / OMCount, 0, slice.Width / OMCount, slice.Height);
int crsr = 0;
foreach (Rectangle cropRect in cropRects)
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using (Graphics g = Graphics.FromImage(target))
g.DrawImage(slice, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
marks[crsr] = target;
crsr++;
long maxPD = (slice.Width / OMCount) * slice.Height * 255;
List<long> inks = new List<long>();
List<long> fullInks = new List<long>();
foreach (Bitmap mark in marks)
inks.Add(InkDarkness(mark));
fullInks.Add(inks[inks.Count - 1]);
int indofMx = -1,indofMn = -1;
long maxD = 0, minD = 0; ;
for (int i = 0; i < OMCount; i++)
if (inks[i] > maxD)
maxD = inks[i];
indofMx = i;
minD = maxD;
for (int i = 0; i < OMCount; i++)
if (inks[i] < minD)
minD = inks[i];
indofMn = i;
for (int i = 0; i < OMCount; i++)
inks[i] -= minD - 1;
bool parallelExist = false, spe = false, tpe = false, fpe = false;
for (int i = 0; i < OMCount; i++)
if (i != indofMx)
if ((double)fullInks[indofMx] / fullInks[i] <= 2)
if (tpe) fpe = true;
if (spe) tpe = true;
if (parallelExist) spe = true;
parallelExist = true;
int negScore = parallelExist ? -1 : 0;
negScore = spe ? -2 : negScore;
negScore = tpe ? -3 : negScore;
negScore = fpe ? -4 : negScore;
if (!parallelExist)
return indofMx + 1;
bool atleastOneUnfilled = false;
for (int i = 0; i < OMCount; i++)
if (i != indofMx)
if ((double)fullInks[indofMx] / fullInks[i] >= 3)
atleastOneUnfilled = true;
if (atleastOneUnfilled)
return negScore;
return 0;
private long InkDarkness(Bitmap OMark)
int darkestC = 255, lightestC = 0;
UnmanagedImage mark = UnmanagedImage.FromManagedImage(OMark);
for (int y = 0; y < OMark.Height; y++)
for (int x = 0; x < OMark.Width; x++)
Color c = mark.GetPixel(x, y);
if (((c.R + c.G + c.B) / 3) > lightestC)
lightestC = ((c.R + c.G + c.B) / 3);
if (((c.R + c.G + c.B) / 3) < darkestC)
darkestC = ((c.R + c.G + c.B) / 3);
int dc = 0;
for (int y = 0; y < OMark.Height; y++)
for (int x = 0; x < OMark.Width; x++)
Color c = mark.GetPixel(x, y);
if (((c.R + c.G + c.B) / 3) < (lightestC + darkestC) / 2)
{ dc += 255; }
return dc;
private Bitmap[] SliceOMarkBlock(System.Drawing.Image fullSheet, Rectangle slicer, int slices)
List<Rectangle> cropRects = new List<Rectangle>();
Bitmap[] bmps = new Bitmap[slices];
for (int i = 0; i < slices; i++)
cropRects.Add(new Rectangle(slicer.X, slicer.Y + (slicer.Height / slices) * i, slicer.Width, slicer.Height/slices));
Bitmap src = (Bitmap)fullSheet;
int crsr = 0;
foreach (Rectangle cropRect in cropRects)
Bitmap target = new Bitmap(cropRect.Width, cropRect.Height);
using (Graphics g = Graphics.FromImage(target))
g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height),
cropRect,
GraphicsUnit.Pixel);
bmps[crsr] = target;
crsr++;
return bmps;
throw new Exception("Couldn't slice");
Its Showing result like ---> -2,-3,-2,-4,-4,-4 and so on up to 100 Questions
is there any one Help me for this.It looks like you've already engaged the author on the CodeProject site and they have attempted to help you. It would be best to finish the discussion there. I'll move this to the C# forums (since it is C# code) but it may get moved again to
Off-Topic since the issue revolves around this particular CodeProject article (and since the author has already attempted to help).
Reed Kimble - "When you do things right, people won't be sure you've done anything at all" -
How to apply reader rights for adding comments and marks?
Hi gurus,
is it possible to allow user to use the comments and marks tools when working with interactive form?
thanks and best regards.
Junhi,
when you run the application .
when your pdf gets displayed.
in the acrobat reader itself, in the acrobat toolbar....
there is a colorful button<option> that has a cloud, a ^ sign, and a dialog box like graphics.
when you click on that it has several options for commenting.
check it out i have never worked on it though.
i hope this helps,
regards,
-ag. -
I recently purchased an Iphone 4 and was not aware that I had to have separate ITunes account. My daughter and I share a computer and apparently she is using the main account on the computer. I went to download some songs from her ITunes and it not only downloaded all of her songs on my phone but also her apps. I do not want her apps. When I went to use the apps that I had on my phone before downloading her ITunes information, they would not open and only go back to the main screen. When I access her apps, they work. Help!!! How can I restore my settings and just take all of the information that I downloaded from her ITunes out and set my own ITunes on the same computer. Any help would really be appreciated.
Create your own user account on your computer, open iTunes, log into your iTunes account on the iTunes Store then sync your iPhone.
http://support.apple.com/kb/HT1495 -
How to get JTable's default TAB behavior and apply it to another key ?
Is there any way to get Table's default behavior of one key say TAB & apply it to the another key say ENTER?
Means I want to disable JTable's default behavior of ENTER key & I want ENTER key should act like TAB.Take a look at this.
[http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html] -
How may I transfer bookmarks into a folder and be able to see all the extensions
would like to go to windows explore and see target desciptions and extensions in a folder setting.. how can this be done?
Firefox 3 stores the bookmarks and the browser history in [http://kb.mozillazine.org/places.sqlite places.sqlite] and no longer creates an HTML backup by default.
You can look at:
Plain old favorites: https://addons.mozilla.org/firefox/addon/668 -
I think its a plug in or something, since the site is foreign. I have some screenshots i'd like to upload.
Error messeges
-
I forget answers to security question , on the other hand rescue email address that Apple use to send me email is not correct , how I can reset security questions or change and make correction for rescue email address ?
Please send me answer to [email protected] or [email protected]
Thank youYou need to contact Apple. Click here, phone them, and ask for the Account Security team.
(87669)
Maybe you are looking for
-
Ghost VM resources under failover cluster manager roles
Hello, everyone, I had a Windows 2012 R2 hyper-v host with few VMs running on it. I deployed a second host, and using SC VMM created a failover cluster. Also I added a shared cluster volume and migrated all VMs to the shared storage using SC VMM cons
-
How to add combo in system matrix ? I am adding a column in the matrix of A/R invoice.I am using the following code- Dim matMatrix As SAPbouiCOM.Matrix Dim objColumn As SAPbouiCOM.Column Dim ddlAP As SAPbouiCOM.ComboBox objForm = S
-
Photoshop CS5 installation.
I can't install Photoshop CS5 upgrade on a new computer. I'm unable to locate the original software purchased in 2001.
-
In both Safari and Firefox, a loading window will occasionally hang and not return the page or take a long time to load. I've emptied the cache, cleared the history, reset the browsers, uninstalled Flash, etc. While a hung window continues to load, I
-
ICloud on PC not syncing with others
Just recently I noticed that when I enter data in calendar, contacts, etc. on my Mac or iPhone or iPad, it does not sync with my Windows PC. It has been until recently. So if I enter a new contact or appt. on hte PC it is not syncing with the other