Class Util
Static helper methods.
Inheritance
Namespace: Lucene.Net.Util.Fst
Assembly: Lucene.Net.dll
Syntax
public sealed class Util : object
Methods
| Improve this Doc View SourceGet<T>(FST<T>, BytesRef)
Looks up the output for this input, or null
if the
input is not accepted
Declaration
public static T Get<T>(FST<T> fst, BytesRef input)
Parameters
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Get<T>(FST<T>, Int32sRef)
Looks up the output for this input, or null
if the
input is not accepted.
Declaration
public static T Get<T>(FST<T> fst, Int32sRef input)
Parameters
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
GetByOutput(FST<Nullable<Int64>>, Int64)
Reverse lookup (lookup by output instead of by input),
in the special case when your FSTs outputs are
strictly ascending. This locates the input/output
pair where the output is equal to the target, and will
return null
if that output does not exist.
NOTE: this only works with
Declaration
public static Int32sRef GetByOutput(FST<long?> fst, long targetOutput)
Parameters
Type | Name | Description |
---|---|---|
FST<System. |
fst | |
System. |
targetOutput |
Returns
Type | Description |
---|---|
Int32s |
GetByOutput(FST<Nullable<Int64>>, Int64, FST.BytesReader, FST.Arc<Nullable<Int64>>, FST.Arc<Nullable<Int64>>, Int32sRef)
Expert: like GetByOutput(FST<Nullable<Int64>>, Int64) except reusing
FST.
Declaration
public static Int32sRef GetByOutput(FST<long?> fst, long targetOutput, FST.BytesReader in, FST.Arc<long?> arc, FST.Arc<long?> scratchArc, Int32sRef result)
Parameters
Type | Name | Description |
---|---|---|
FST<System. |
fst | |
System. |
targetOutput | |
FST. |
in | |
FST. |
arc | |
FST. |
scratchArc | |
Int32s |
result |
Returns
Type | Description |
---|---|
Int32s |
ReadCeilArc<T>(Int32, FST<T>, FST.Arc<T>, FST.Arc<T>, FST.BytesReader)
Reads the first arc greater or equal that the given label into the provided
arc in place and returns it iff found, otherwise return null
.
Declaration
public static FST.Arc<T> ReadCeilArc<T>(int label, FST<T> fst, FST.Arc<T> follow, FST.Arc<T> arc, FST.BytesReader in)
Parameters
Type | Name | Description |
---|---|---|
System. |
label | the label to ceil on |
FST<T> | fst | the fst to operate on |
FST. |
follow | the arc to follow reading the label from |
FST. |
arc | the arc to read into in place |
FST. |
in | the fst's FST. |
Returns
Type | Description |
---|---|
FST. |
Type Parameters
Name | Description |
---|---|
T |
ShortestPaths<T>(FST<T>, FST.Arc<T>, T, IComparer<T>, Int32, Boolean)
Starting from node, find the top N min cost completions to a final node.
Declaration
public static Util.TopResults<T> ShortestPaths<T>(FST<T> fst, FST.Arc<T> fromNode, T startOutput, IComparer<T> comparer, int topN, bool allowEmptyString)
Parameters
Type | Name | Description |
---|---|---|
FST<T> | fst | |
FST. |
fromNode | |
T | startOutput | |
IComparer<T> | comparer | |
System. |
topN | |
System. |
allowEmptyString |
Returns
Type | Description |
---|---|
Util. |
Type Parameters
Name | Description |
---|---|
T |
ToBytesRef(Int32sRef, BytesRef)
Declaration
public static BytesRef ToBytesRef(Int32sRef input, BytesRef scratch)
Parameters
Returns
Type | Description |
---|---|
Bytes |
ToDot<T>(FST<T>, TextWriter, Boolean, Boolean)
Dumps an FST<T> to a GraphViz's dot
language description
for visualization. Example of use:
using (TextWriter sw = new StreamWriter("out.dot"))
{
Util.ToDot(fst, sw, true, true);
}
and then, from command line:
dot -Tpng -o out.png out.dot
Note: larger FSTs (a few thousand nodes) won't even render, don't bother. If the FST is > 2.1 GB in size then this method will throw strange exceptions.
See also http://www.graphviz.org/.
Declaration
public static void ToDot<T>(FST<T> fst, TextWriter out, bool sameRank, bool labelStates)
Parameters
Type | Name | Description |
---|---|---|
FST<T> | fst | |
Text |
out | |
System. |
sameRank | If |
System. |
labelStates | If |
Type Parameters
Name | Description |
---|---|
T |
ToInt32sRef(BytesRef, Int32sRef)
Just takes unsigned byte values from the Bytes
NOTE: This was toIntsRef() in Lucene
Declaration
public static Int32sRef ToInt32sRef(BytesRef input, Int32sRef scratch)
Parameters
Returns
Type | Description |
---|---|
Int32s |
ToUTF16(String, Int32sRef)
Just maps each UTF16 unit (char) to the
Declaration
public static Int32sRef ToUTF16(string s, Int32sRef scratch)
Parameters
Type | Name | Description |
---|---|---|
System. |
s | |
Int32s |
scratch |
Returns
Type | Description |
---|---|
Int32s |
ToUTF32(Char[], Int32, Int32, Int32sRef)
Decodes the Unicode codepoints from the provided
char[] and places them in the provided scratch
Int32snull
, returning it.
Declaration
public static Int32sRef ToUTF32(char[] s, int offset, int length, Int32sRef scratch)
Parameters
Type | Name | Description |
---|---|---|
System. |
s | |
System. |
offset | |
System. |
length | |
Int32s |
scratch |
Returns
Type | Description |
---|---|
Int32s |
ToUTF32(String, Int32sRef)
Decodes the Unicode codepoints from the provided
ICharnull
, returning it.
Declaration
public static Int32sRef ToUTF32(string s, Int32sRef scratch)
Parameters
Type | Name | Description |
---|---|---|
System. |
s | |
Int32s |
scratch |
Returns
Type | Description |
---|---|
Int32s |