whoosh python search engine. is there a way to add custom variations? - whoosh

Is there a way to define a custom variation list in Whoosh?
For example, 'cat'->'caterpillar'
In the Whoosh python package, I am trying to add a custom variation equivalence.
I can see that the variations are defined with a set of rules in whoosh.lang.morph_en but I can't see a way to add custom variations to that. Is there a way I am missing?

Related

How to extend IErrorParser in eclipse to define own syntax checking?

My intention is to have own naming rules in eclipse editor for C programming
Ex: a function should start with File name, it shall contain maximum of 20 character- FILENAME_MaxOf20Char().
When it is violated has to show an warning.
To do this tried to extend org.eclipse.cdt.core.IErrorParser. But this one is parsing from compilor output.
IErrorParser is not the right extension point to use for this.
You want to use the Code Analysis (CodAn) framework and write a custom checker. See this page for documentation.

Display Classes and Interfaces Separately using Doxygen

I'm trying to document a C# project using Doxygen.
With the default configurations, after generating the HTML output, this is what I get for the namespace documentation.
The output adds both Classes and Interfaces to the same list.
I've tried changing some of the configurations, for instance trying to set OPTIMIZE_OUTPUT_JAVA=YES to see if something changed, but nothing seems to change.
Do you know if it is possible to generate an output with two different lists, one for classes, other for interfaces, and possibly another for enums?
Thanks.
You could do this manually with pages.
DISABLE_INDEX = YES
GENERATE_TREEVIEW = NO
Then manually create pages for each of your categories and include the objects you want on each page.

Is it possible to reuse flexform field definitions using EXT:flux?

I'm new to the fedext-universe. By now, I've created a set of content elements, and they work fine.
There is one drawback though: One set of content elements has some fields in common, and these fields are rather complicated. Usually, I'd move their definition to a partial, but that isn't possible in flux forms. The beginners guide states
Flux templates can use Layouts and
Partials - but a Flux form cannot
be split into Partial templates.
Is there any way to avoid redefining these fields over and over again? Among other things, I've tried to use the <vhs:render.inline> viewhelper along with a custom viewhelper, returning the fluid-definition of the fields, but I can't get that to work.
Flux 7.0 will bring the option to place fields and sheets into Partial templates - if you are currently in a development project, I recommend trying it out from the development branches on Github:
https://github.com/FluidTYPO3/flux/tree/development
Flux 7.0 also will bring the option to create PHP classes which for example create ready-made sheets with a bunch of fields - such a class would be ideal to reuse, simply requiring one PHP class and one Fluid ViewHelper. Such an approach would be more efficient when your forms are rendered, but of course is much more technically demanding than a Partial template.
EDIT: though not yet documented, creating custom sheets involves two simple steps: 1) create a subclass of FluidTYPO3\Flux\Form\Container\Sheet and a subclass of FluidTYPO3\Flux\ViewHelpers\Form\SheetViewHelper - then include your namespace in the template, use your own ViewHelper instead of a flux:form.sheet (and add additional fields if you need them) and then inside the Sheet object, use the $this->createField() method from within object initialization, to automatically add any number of fields with predefined names, labels etc.

Modify a drools rule to set rule attributes programmatically

I see classes like org.drools.lang.api.PackageDescrBuilder and org.drools.lang.api.impl.RuleDescrBuilderImpl to create rules programmatically, but I don't see any examples of that.
Basically user will create a rule and upload the file to a location. I have read these rule files and set rule attributes like date-effective, date-expires, enabled etc.
As per org.drools.rule.Rule api, there are methods to set, but I don't get any idea on how to read the rule.drl file and convert it to object of type org.drools.rule.Rule.
Any idea on this or how to modify a drools rule using drools api will be useful.
Note: I don't want to do string replacement for modifying a rule.
You could take a look at the tests for the PackageBuilder:
https://github.com/droolsjbpm/drools/blob/5.6.x/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
... which has examples of doing this.

i18n in Symfony Forms

Is there any way I can use the format_number_choice function inside of a actions file. In fact I need to use it for a Form error message.
'max_size' => 'File is too large (maximum is %max_size% bytes).',
In English it's simply "bytes", but in other languages the syntax changes after a certain value (for example if the number is greater than 20 it's: "20 of bytes").
I can use parenthesis, of course, but if the framework offers support for doing this specific thing, why not to use it?!
The way it's currently implemented in the 1.4 branch, you can define only one translation per message using il18n XML files.
What you could do is create a custom validator which inherits the current validator (sfValidatorFile in your example) and does the size checking in the doClean method before calling its parent's method.
I suggest you take a look at the source to see how it works : sfValidatorFile
The correct way to handle number ranges for translation is explained here in the Definitive Guide. I won't reproduce it here as the documentation itself is clear and concise. Note however that the string is not extracted automatically by the i18n-extract task, so you need to add it manually - again, the documentation explains this.
So yes, you can use the format_number_choice() function inside an action - you just need to load the helper inside the action like this:
sfContext::getInstance()->getConfiguration()->loadHelpers('I18N');