Hi  Adam Lally ,

                           as per ur code below i have tried


analysisEngine.setConfigParameterValue("StringsToAnnotate",
 new String[] {"Michael","UIMA","Vijay",....}); but it is giving anerror
like analysisEngine cannot be resolved. i am attching the class what i
wrote.

vijay




On 9/12/07, Adam Lally <[EMAIL PROTECTED]> wrote:
>
> Vijay,
>
> This message, where you say what you did so far and ask a specific
> question, is a step in the right direction.  So I'm going to try to
> answer your questions.  But if you say "plz give me response" or any
> kind of begging for help one more time I am never responding to any of
> your messages again.  Sorry to be so blunt, but begging for help does
> NOT make us more likely to help you, and you have to stop.  We are all
> busy people and it is very disrespectful to do what you just did and
> send a follow up message after only 3 hours, being upset that Michael
> didn't take time from his day during those particular 3 hours to give
> you a response.
>
> Responses below...
>
> On 9/12/07, vijay vijay <[EMAIL PROTECTED]> wrote:
> > thank u for ur kind response,
> >
> >                      let me tell u exactley where i am
> >
> >                   i have downloded  plugins for eclipse and i have
> wriiten
> > code for analysis engine and java class for annotation where it reads
> two
> > strings like "MICHAEL,UIMA" in bunch of input txtxfiles.I have done it
> > sucessfully. i am able get the annotation in document analyzer.
> >
> >                     here i thought insted of hardcoding or sending it as
>
> > parameters Can we pass annotations dynamically? i have put this question
> > acroos forums no replies for it.
> >
>
> You can set a configuration parameter dynamically.  So if your
> annotator has a  multivalued configuration parameter called
> "StringsToAnnotate" of type String, you can set that from your
> application using:
>
> analysisEngine.setConfigParameterValue("StringsToAnnotate",
> new String[] {"Michael","UIMA","Vijay",....});
>
>
> >                    how do u  write main class? in uima...........
> >
>
> Have you looked at ExampleApplication.java?  It is in the UIMA SDK
> example source code
> (examples/src/org/apache/uima/examples/ExampleApplication.java).  It
> shows how you create an AnalysisEngine object from a descriptor, and
> then pass documents to it and read the results.
>
> There's also a detailed discussion of this in the "Application
> Developer's Guide" chapter of the manual.  Here's a link to the online
> documentation: 
> http://incubator.apache.org/uima/downloads/releaseDocs/2.2.0-incubating/docs/html/tutorials_and_users_guides/tutorials_and_users_guides.html#ugr.tug.application
> .
>
> If you try for a while to get this to work and something is still not
> working, then post a follow up question saying what exactly you tried
> and what exactly is going wrong.  Posting code and any exception
> messages will be very helpful and will encourage people to respond
> more quickly.
>
> >                  i have deployed examples up to collection process
> engine.
> >
> >            I will tell u my aim also i want to send Michale as client
> > request from a jsp page it should be able to get all occurences of
> > michale.how do u achive this?
> >
>
> Get all occurrences of "Michael" from where? Do you have a collection
> of documents that you want to search?
>
> Using the advice I gave above you could create an AnalysisEngine, set
> the StringsToAnnotate parameter to "Michael" and then run it over a
> collection of documents.  But if your collection is of any significant
> size this will take a long time, so you can't expect a user to submit
> a request over the web and sit there waiting for the response.
>
> Typically for search applications using UIMA is that you run your
> annotator off-line and produce an index, which you then search against
> when the user submits a request.  Of course you have to know what
> kinds of things you are looking for ahead of time.
>
> If you're just searching for strings like "Michael" and you don't know
> what they are ahead of time, you might as well just use Google, you
> don't need UIMA for that.
>
> >         thats what i am aiming for,if u suggest me  how to proceed i
> will be
> > thank full to u ,i thinking that u are like guide to me.no one is there
> to
> > help me.i have searched across web so many pdfs but i storgley belive
> that i
> > need some help form some one and that is u ,every thing is in ur hands
> to
> > say yes or no is up to u boss .
> >
> >     i am happy for ur response.once again thank u micahle.
>
> This isn't helping.  You can say "Thank you for your help" once but
> you don't need a whole paragraph plus yet another sentence to say it.
>
> And while I can overlook lots of spelling errors, why don't you seem
> able to type "Michael" correctly?  All you have to do is copy it from
> the previous email!  Not taking the time to spell people's names
> correctly is also not very respectful to people that are taking time
> out of their busy day just to help you out.  And would it kill you to
> capitalize the first letter of sentences and spell out "you" and
> "your"?  This is email, not instant messaging.
>
> Regards,
> -Adam
>
analysisEngine.setConfigParameterValue("StringsToAnnotate",
 new String[] {"Michael","UIMA","Vijay",....});


package com.iton.uima.src;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.ibm.uima.UimaContext;
import com.ibm.uima.analysis_component.AnalysisComponent;
import com.ibm.uima.analysis_component.JCasAnnotator_ImplBase;
import com.ibm.uima.analysis_engine.AnalysisEngineProcessException;
import com.ibm.uima.jcas.impl.JCas;
import com.ibm.uima.resource.ResourceInitializationException;
import com.iton.uima.DynamicAnnotation;
import com.ibm.uima.cas.TypeSystem;


public class DyanamicAnnotations extends JCasAnnotator_ImplBase {
        
        
        
          private Pattern[] firstString;
          private String [] secondString;
          
         
          public void initialize(UimaContext aContext)
            throws ResourceInitializationException
          {
                  super.initialize(aContext);
                  
                    //Get config. parameter values
                  
                    String[] patternStrings = 
                      (String[])aContext.getConfigParameterValue("Patterns");
                    
                    secondString = 
(String[])aContext.getConfigParameterValue("Location");
                    
                    System.out.println("mLocations----->"+secondString);
                    for (int i = 0; i < secondString.length; i++){
                        System.out.println("mLocations 
value--->"+secondString[i]);
                        
analysisEngine.setConfigParameterValue("StringsToAnnotate",
                                         new String[] 
{"Michael","UIMA","Vijay"});

                   }
                    //compile regular expressions
                    firstString = new Pattern[patternStrings.length];
                    for (int i = 0; i < patternStrings.length; i++)
                    {
                        System.out.println("is this working or not");
                        firstString[i] = Pattern.compile(patternStrings[i]);  
                    }    
                  }

                  /**
                   * @see JCasAnnotator_ImplBase#process(JCas)
                   */
                  public void process(JCas aJCas)
                    throws AnalysisEngineProcessException
                  {
                    //get document text
                    String docText = aJCas.getDocumentText();
                    System.out.println("docText---------->"+docText);
                    //loop over patterns
                    System.out.println("mPattern 
length---------->"+firstString.length);
                    for (int i = 0; i < firstString.length; i++)
                    {
                        System.out.println("is For loop");
                      Matcher matcher = firstString[i].matcher(docText);
                      int pos = 0;
                      while (matcher.find(pos))
                      {
                        //found one - creation annotation
                        
                 DynamicAnnotation annotation = new DynamicAnnotation(aJCas);
                        annotation.setBegin(matcher.start());
                        annotation.setEnd(matcher.end());
                        annotation.addToIndexes();
                        annotation.setStringsToAnnotate(secondString[i]);
                        pos = matcher.end();
                        System.out.println("Is Text at Last-------->");
                        //getContext().getLogger().log(Level.FINEST,"Found: " + 
annotation);
                        
                      }
                    }  
                  }
                 

                }



























Reply via email to