• Show convenient version of this site
  • Deutsch
  • English
Contact
Newsletter
  • Products
    • ALS
      • Across Language Server
        • Translation Management
        • Terminology Management
        • Translation Memory
      • Editions
      • Interfaces
    • ATE
      • Across Translator Edition
      • Editions
      • Download
      • Across Account
    • Elanion
      • Overview
      • Login
  • Solutions
    • Customers
      • Enterprises
      • Language Service Providers
      • Translators
    • Industries
      • E-Commerce & Trade
      • Pharmaceuticals & medicine
      • IT & Software
    • Departments
      • Marketing & E-Commerce
      • Technical Documentation
      • Software User Interfaces
  • Services
    • Hosting
    • Training
    • Consulting
  • Partners
    • Language Service Providers
    • Universities
    • Organisations
  • Company
    • Across Systems
    • News
    • Events
    • Career
    • Contact
  • Knowledge
    • Blog
    • Video Library
    • Case Studies
    • White Papers
    • Fact Sheets
    • File Formats
    • Expert Features
  • Support
    • Online Help
    • FAQ
    • Support Request
    • Updates
    • New Functions
Schedule Consultation
  • Online-Help
  • SDK
  • APIs
  • crossTerm API v1
  • crossTerm API with C#
  • General Information
    • Connectors
    • LCIDs
    • GUIDs
    • Paragraph states and flags
    • crossTerm Web
    • crossTransform
      • crossTransform - examples
  • Connecting Third-party Systems
    • crossConnect for content systems
      • Requirements
      • Configuration
        • Configuring the connector
        • Job configuration
        • Testing crossConnect
      • Troubleshooting
    • crossConnect for External Editing
      • Purpose and usage
        • Use case - Machine translation
        • Use Case - Review and QA
        • Use case - Machine review
      • 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
          • Adding workflows to crossAutomate Host Manager
          • Adjusting preset watchfolders
          • The filter rules
          • External editing workflows
        • Sample code - Integrated solution
    • Generic File Connector
      • Process Overview
      • Exchange Folder Structure
      • Package Format
        • Control File
  • Display Texts
    • Solution approaches
    • The Across solution in detail
    • Requirements
    • Integration
    • The display text format
      • Line height vs. line spacing
      • DT-XML format structure
        • DT-XML - Main elements
        • Children of paragraphStyles and characterStyles
        • Children of the sizeInfos element
        • Children of the paragraph element
        • DT-XML v5 example
        • DT-XML v4 example
    • The display text package
      • Creating a display text package
  • APIs
    • APIs - Technology
    • crossTank API v1
      • Requirements
      • Testing the crossTank API installation
      • OData-URLs in Chrome
      • Example
    • crossTank API v2
      • Requirements
      • QuickStart
        • Searching for Translations
        • Creating Translations
      • crossTank API v2 Overview
        • Finding Translations
        • Creating Translations
        • Translation Properties
        • Formatting and Auto-Adjustment of Formatting and Numbers
      • C# Example
    • crossTerm API v1
      • Scenarios of use
        • Example - usage information
        • Example - finding terms
      • Requirements
      • Special Controllers
      • OData-URLs in Chrome
      • crossTerm API with C#
      • crossTerm API with Java
      • crossTerm API with JavaScript
    • crossTerm API v2
      • Requirements
      • QuickStart
        • Authentication Basics
        • First Request Examples
      • crossTerm API v2 Example in C#
        • Used Functions
      • crossTank API, crossTerm API v2 - Authentication
      • crossTerm API v2 - Examples of Use
        • Finding Terms of Entry
        • Searching Terminology via API
    • crossAPI SI
      • Requirements
      • Function Return Types
      • crossAPI SI and Java
        • Example: hot integration
        • Executing the hot integration example
      • List of Objects in crossAPI SI
        • AssignManager
        • Authorization
        • CheckInManager
        • CheckOutManager
        • CrossTankManager
        • CrossTermManager
        • DocumentManager
        • FileManager
        • LanguageJobManager
        • LanguageManager
        • LicenseManager
        • Message
        • ObjectManager - Overview
          • Part 1
          • Part 2
          • Part 3
        • ReportManager
          • ID values for analysis and analysis-result
        • ProjectManager - Overview
          • Part 1
          • Part 2
          • Attribute Information
        • SqlQuery
        • SystemManager
        • TaskManager
        • WanGridManager - Overview
          • Part 1
          • Part 2
      • Sample - transferring checkout files via FileManager
      • Sample - VBS
    • Text Preprocessing API
      • Introduction
      • How to browse the API
      • Sentence splitting
      • Abbreviations

crossTerm API with C#

This example illustrates all available search types by way of a small desktop application written in C#. The application retrieves first terms and then properties in a second step. It illustrates usage information by coloring.

Getting started

If you want to reproduce this example, you can download and extract the ZIP file.

crossTermAPI_CSharp_Sample

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 Modes

This client illustrates the search modes SearchTerms, WildcardSearch and SearchTermsInText.

In the UI, the modes SearchTerms and WildcardSearch are combined. If the user enters a string with the * character, WildcardSearch is started internally - otherwise, SearchTerms is used.

In SearchTermsViewModel.cs

if(SearchTermText.Contains("*")){
     await WildecardSearchTerm(parameters, Top);}else{
     await SearchTerm(parameters);}

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.

cTe_API_sprachSuche

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;}
Tip

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.

Load ... immediately turned off
Load ... immediately turned on
cTe_API_Load_Immediately_Off
cTe_API_Load_Immediately_On

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.
cTe_API_SearchTermsInText

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:

cTe_API_SearchTermsInTextUnfolded

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.

cTe_API_RangeForWordForm
Register for our Newsletter now

Our newsletter provides you with exclusive news about the Across Language Server, often even before the official announcement. The newsletter also provides you with early information on events, webinars, and training sessions.

  • Legal Notice
  • GTC
  • Privacy Statement
  • Cookies
  • info@across.net