You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Richard Eckart de Castilho <re...@apache.org> on 2014/01/22 02:16:53 UTC

A method that creates a JCas from text and language?

Hi,

the subject suggests a pretty trivial question. Actually it is,
but then again it is not.

The uimaFIT JCasFactory defines several convenience methods to
create JCases. The difference between the methods is basically
how they get their type system information:

1) automatically through classpath scanning
2) using named descriptors from the classpath
3) using named descriptors from the file system
4) using a type system description

However, I recently find myself more in need of a method
that creates a JCas and initializes it with a text and
a language. I've become quite accustomed to uimaFIT's
type discovery mechanism, so that I do not actually need
any parameter to specify a type system.

Naively, I'd create a new method with the signature

  JCas createJCas(String language, String text)

but there is already a signature 

  JCas createJCas(String… typeSystemDescriptorNames)

so this is not possible. So I currently still end up writing

  JCas jcas = JCasFactory.createJCas();
  jcas.setDocumentText(…);
  jcas.setDocumentLanguage(…);

Did anybody else ever miss this method that I describe?
If so, do you have any suggestion how to call it other
than createJCas()?

Cheers,

-- Richard

P.S.: Feel free to call me crazy for suggesting this in the
first place - but one aspect of uimaFIT is to provide very
concise language for often-used functionality. This is targeting
folks who want to write as few lines/commands as possible while
getting the most out of it.



Re: A method that creates a JCas from text and language?

Posted by Richard Eckart de Castilho <re...@apache.org>.
Thanks for the feedback :)

I think I like createJCasWithText(…).

-- Richard

On 22.01.2014, at 12:48, Marshall Schor <ms...@schor.com> wrote:

> On 1/21/2014 8:16 PM, Richard Eckart de Castilho wrote:
>> Hi,
>> 
>> the subject suggests a pretty trivial question. Actually it is,
>> but then again it is not.
>> 
>> The uimaFIT JCasFactory defines several convenience methods to
>> create JCases. The difference between the methods is basically
>> how they get their type system information:
>> 
>> 1) automatically through classpath scanning
>> 2) using named descriptors from the classpath
>> 3) using named descriptors from the file system
>> 4) using a type system description
>> 
>> However, I recently find myself more in need of a method
>> that creates a JCas and initializes it with a text and
>> a language. I've become quite accustomed to uimaFIT's
>> type discovery mechanism, so that I do not actually need
>> any parameter to specify a type system.
>> 
>> Naively, I'd create a new method with the signature
>> 
>>  JCas createJCas(String language, String text)
>> 
>> but there is already a signature 
>> 
>>  JCas createJCas(String… typeSystemDescriptorNames)
>> 
>> so this is not possible. So I currently still end up writing
>> 
>>  JCas jcas = JCasFactory.createJCas();
>>  jcas.setDocumentText(…);
>>  jcas.setDocumentLanguage(…);
>> 
>> Did anybody else ever miss this method that I describe?
>> If so, do you have any suggestion how to call it other
>> than createJCas()?
> 
> How about a name made of 3 parts; here are some suggestions for the parts:
>   part 1:   create
>   part 2:   AndPopulate
>   part 3:   JCas
> 
> Alternatives for part 1:
>   setup, make, fabricate (or fab :-) ), build, generate, produce, hatch ( :-) )
> 
> Alternatives for part 2:
>   <nothing>, WithSofa,
> 
> Also, could put part 2 after part 3: e.g.
>  createJCasWithSofa
> 
> Cheers - Marshall
>> Cheers,
>> 
>> -- Richard
>> 
>> P.S.: Feel free to call me crazy for suggesting this in the
>> first place - but one aspect of uimaFIT is to provide very
>> concise language for often-used functionality. This is targeting
>> folks who want to write as few lines/commands as possible while
>> getting the most out of it.


Re: A method that creates a JCas from text and language?

Posted by Marshall Schor <ms...@schor.com>.
On 1/21/2014 8:16 PM, Richard Eckart de Castilho wrote:
> Hi,
>
> the subject suggests a pretty trivial question. Actually it is,
> but then again it is not.
>
> The uimaFIT JCasFactory defines several convenience methods to
> create JCases. The difference between the methods is basically
> how they get their type system information:
>
> 1) automatically through classpath scanning
> 2) using named descriptors from the classpath
> 3) using named descriptors from the file system
> 4) using a type system description
>
> However, I recently find myself more in need of a method
> that creates a JCas and initializes it with a text and
> a language. I've become quite accustomed to uimaFIT's
> type discovery mechanism, so that I do not actually need
> any parameter to specify a type system.
>
> Naively, I'd create a new method with the signature
>
>   JCas createJCas(String language, String text)
>
> but there is already a signature 
>
>   JCas createJCas(String… typeSystemDescriptorNames)
>
> so this is not possible. So I currently still end up writing
>
>   JCas jcas = JCasFactory.createJCas();
>   jcas.setDocumentText(…);
>   jcas.setDocumentLanguage(…);
>
> Did anybody else ever miss this method that I describe?
> If so, do you have any suggestion how to call it other
> than createJCas()?

How about a name made of 3 parts; here are some suggestions for the parts:
   part 1:   create
   part 2:   AndPopulate
   part 3:   JCas

Alternatives for part 1:
   setup, make, fabricate (or fab :-) ), build, generate, produce, hatch ( :-) )

Alternatives for part 2:
   <nothing>, WithSofa,
 
Also, could put part 2 after part 3: e.g.
  createJCasWithSofa

Cheers - Marshall
> Cheers,
>
> -- Richard
>
> P.S.: Feel free to call me crazy for suggesting this in the
> first place - but one aspect of uimaFIT is to provide very
> concise language for often-used functionality. This is targeting
> folks who want to write as few lines/commands as possible while
> getting the most out of it.
>
>
>