- General Information
- Connecting Third-party Systems
- crossConnect for content systems
- crossConnect for External Editing
- Purpose and usage
- Requirements
- Implementation
- Across XLIFF format
- Across-specific Extensions
- <xliff> Element Attributes
- <file> Element Extensions
- <trans-unit> Element Extension
- Paragraph States
- Paragraph State Flags
- <source> and <target> Element Content
- <bpt> Element Attributes
- <ph> Element Attributes
- <x> Element Attributes
- Across-specific Properties
- Analysis Results
- Sample Files
- Across XLIFF - import, export and segmentation
- Context information
- Exporting best matches in Across XLIFF
- Hyperlinks to XLIFF
- Secure file handling with C#
- Secure file handling with JAVA
- Workflow and vendor configuration
- Sample code - Integrated solution
- Across XLIFF format
- Generic File Connector
- Display Texts
- APIs
- APIs - Technology
- crossTank API v1
- crossTank API v2
- crossTerm API v1
- crossTerm API v2
- crossAPI SI
- Requirements
- Function Return Types
- crossAPI SI and Java
- List of Objects in crossAPI SI
- Sample - transferring checkout files via FileManager
- Sample - VBS
- Text Preprocessing API
crossTerm API with C#
Configuration and start
After extracting the demo file, place binaries from the contained folder bin\ExampleApplication to a place on your file system from where the crossTerm API can be reached.
In ExampleApplication.exe.config, make sure that the URI in the settings points to the right location:
<setting name="crossTermServer" serializeAs="String"><value>http://localhost/Across/CrossTerm</value></setting>
After that, start the exe.
Search Option Languages
The client illustrates how language information can be provided as parameters for the search.
The search functions accept language codes (LCIDs) for source and target languages as parameters (see crossTerm API online help: /Help/ResourceModel?modelName=TermsSearchParameters).
However, this example application displays language labels for selection in a drop-down list, so the user does not need to provide LCIDs. The languages are those languages which have been activated for usage in the Across Language Server, and thus all languages for which terms might exist in crossTerm.
The following code retrieves the language labels. For retrieving the Across Language Server languages, the crossTerm API offers the controller /deprecated/api/v1/Languages. (This controller might change or move in the future.) The service URL is represented in TemporaryCoreDataContext ctx, so the Languages may be retrieved via ctx.Languages.ExecuteAsync().
In SearchTermsViewModel.cs :
private async void LoadLanguagesAsync(){ IsBusy =true;try{ TemporaryCoreDataContext ctx =new TemporaryCoreDataContext();var query = ctx.Languages.OrderBy(l => l.Name); Languages =new ObservableCollection<Language>(await ctx.Languages.ExecuteAsync());}catch(Exception exc){ LastError = exc;} IsBusy =false;}
In this example application, the Target language code may be provided, but it does not influence on search results. This example application retrieves terms in the source language only. Information on the target language is relevant only if the TranslationsFilter parameter is used, which is not the case in the example. The TranslationsFilter parameter interprets the Target language LCID (see crossTerm API online help: /Help/ResourceModel?modelName=TermsSearchParameters).
Load options
The load options show the effect of retrieving all properties at once or later (in the background). If all information is retrieved in one go, this may lead to waiting times. In particular, delays might be observed for large terminology databases, containing terms with many properties, and when the wildcard search returns a lot of results.
You can observe the effects by the time elapsed (in ms), shown in the bottom right corner.
The following screenshot shows a test with Load ... immediately turned off, and another test on the same crossTerm data with Load ... immediately turned on. Note the difference in load time.
The following code snippet shows where Load Options are checked (SearchTermsViewModel.cs ):
if(AllowLoadProperties){ queryText ="$expand=FoundTerms/Properties/Children";if(AllowLoadEntries){ queryText +=",FoundTerms/Entry/Properties/Children";}}elseif(AllowLoadEntries){ queryText ="$expand=FoundTerms/Entry";}else{ queryText ="$expand=FoundTerms";}
Usage information
As long as term properties haven't been loaded (see options on immediate/background loading above), no information about the intended usage of terms is known. During this time, the bar in the left margin is gray for each term.
- After loading the term properties, the Usage flag is interpreted as follows:
- Recommended: green
- DoNotUse: red
- Normal: blue
So, in the example above, cancel and calculate have the usage information recommended.
Search terms in text
- The search mode SearchTermsInText allows to find all terms in a longer text. The results are represented along with
- the character range of the matching string,
- the number of matching terms for this range, and
- "Terms", a control that may be expanded to see the term names of found terms.
The function to call SearchTermsInText looks like this (CrossTermDataContext.cs):
public Task<IEnumerable<TermsSearchResult>> SearchTermsInTextAsync(string text, TermsSearchParameters parameters,int maxWordsCombination =3,string additionalODataSettings =null){returnthis.ExecuteAsync<TermsSearchResult>(new Uri("/Terms/SearchTermsInText?"+(additionalODataSettings ??"$expand=FoundTerms"), UriKind.Relative),"POST",false,new BodyOperationParameter("query",new SearchTermsInTextQuery { TextFragment = text, MaxWordsCombination = maxWordsCombination, Parameters = parameters));}
Maximum length of terms in number of words
Note that the example application specifies maxWordsCombination = 3 (line 1 in snippet). This means that terms of a maximum length (in words) of 3 are found. So, for example, the multi-word term "Cancel and exit" (which has three words) is found. Longer terms, such as "Cancel and Exit Button" would not be found in the text, because they exceed the value of maxWordsCombination.
Ranges in text
Text ranges for which terms were found are provided as start and end position, counted in characters in the input string.
So, for example, consider the input sentence Cancel and exit the application.
Compare the results:
The first term is found for the positions 0 to 6 (represented as {0:6} in the example), which corresponds to Cancel.
Additionally, a term is found for the positions 0 to 15, which corresponds to Cancel and exit.
This illustrates that ranges might be overlapping or nested.
Ranges for word forms
In a running text, terms may occur not only in their base form (which is usually the one entered as a term in crossTerm), but also as word forms (inflected forms). To find terms for these forms, the parameter UseStemming can be set to 1 (see crossTerm API online help: /Help/ResourceModel?modelName=TermsSearchParameters).
This enables a mechanism to match word forms to base forms, such as Cancelling (in submitted text) to cancel (term). The returned range is anyway that for Cancelling ({0:10} in the screenshot below). Note that this mechanism is currently supported for a set of twelve languages.