我們的分析器可以智慧識別並自動偵測上傳文件中的唯一欄位值。
偵測掃描或列印文件、影像和 PDF 文件的語言。
將掃描或列印的文件(包括圖像和 PDF 文件)轉換為機器可讀的文字。
我們的文件分析器可以整合到現有的軟體系統或工作流程中。
Parse Documents 是一組強大的 API,旨在滿足所有文件分析要求。我們的目標是簡化管理文件的複雜過程,無論是搜尋、分析或處理錯誤。其中包括簡單的頁面排序、廣泛的支援文件類型以及全面的錯誤報告。
使用我們的各種 API,您不僅可以讀取上傳的文檔,還可以透過直接上傳或外部連結對文檔進行排隊以進行分析。我們的 API 在設計時考慮了業務的動態特性,使它們能夠無縫地適應各種業務需求和配置。
API 根據 OpenAPI 規格 (OAS) 進行編碼,讓整合流程變得輕鬆簡單。我們提供基於 Swagger 使用者介面的大量文檔,詳細說明了可能的回應以及可能的狀態和錯誤代碼。
所有 API 請求均使用 JWT 標頭進行身份驗證,以實現最大程度的安全性。這可確保您的敏感文件資料始終受到保護。
我們很高興您的加入,並且迫不及待地想看看您如何在文件管理作業中整合並最大限度地發揮 Parse Documents 的優勢!
POST /v1/documents/languages
A POST method that identifies the languages of the provided document text. This method takes the document text as input and returns the identified languages along with their probabilities.
POST /v1/documents/languages
{ "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }
import requests url = "https://%(baseUrl)s/v1/documents/languages" headers = { "Authorization": "Bearer {YOUR_API_KEY}" } payload = { "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit." } response = requests.post(url, headers=headers, json=payload) response.raise_for_status() identified_languages = response.json() for lang in identified_languages: print(f"Language: {lang['code']} - Probability: {lang['probability']}")
package main import ( "fmt" "net/http" "bytes" "encoding/json" ) func main() { identifyDocumentLanguages() } func identifyDocumentLanguages() { url := "https://%(baseUrl)s/v1/documents/languages" apiKey := "{YOUR_API_KEY}" payload := map[string]interface{}{ "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", } requestBody, _ := json.Marshal(payload) req, _ := http.NewRequest("POST", url, bytes.NewBuffer(requestBody)) req.Header.Set("Authorization", "Bearer "+apiKey) req.Header.Set("Content-Type", "application/json") client := &http.Client{} response, _ := client.Do(req) identifiedLanguages := []map[string]interface{}{} json.NewDecoder(response.Body).Decode(&identifiedLanguages) for _, lang := range identifiedLanguages { fmt.Printf("Language: %v - Probability: %v\n", lang["code"], lang["probability"]) } }
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://%(baseUrl)s/v1/documents/languages", CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode([ "text" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit." ]), CURLOPT_HTTPHEADER => [ "Authorization: Bearer {YOUR_API_KEY}", "Content-Type: application/json" ], ]); $response = curl_exec($curl); $error = curl_error($curl); curl_close($curl); if ($error) { echo "Error: " . $error; } else { $identifiedLanguages = json_decode($response, true); foreach ($identifiedLanguages as $lang) { echo "Language: " . $lang['code'] . " - Probability: " . $lang['probability'] . "\n"; } }
using System; using System.Net.Http; using System.Text; using System.Text.Json; using System.Threading.Tasks; class Program { private static readonly HttpClient client = new HttpClient(); private static readonly string BASE_URL = "{YOUR_API_BASE_URL}"; private static readonly string API_KEY = "{YOUR_API_KEY}"; static void Main(string[] args) { IdentifyDocumentLanguages().Wait(); } private static async Task IdentifyDocumentLanguages() { try { client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", API_KEY); var requestBody = new { text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }; var requestContent = new StringContent(JsonSerializer.Serialize(requestBody), Encoding.UTF8, "application/json"); var response = await client.PostAsync(BASE_URL + "/v1/documents/languages", requestContent); response.EnsureSuccessStatusCode(); var responseBody = await response.Content.ReadAsStringAsync(); var identifiedLanguages = JsonSerializer.Deserialize<IdentifyLanguage[]>(responseBody); foreach (var lang in identifiedLanguages) { Console.WriteLine($"Language: {lang.code} - Probability: {lang.probability}"); } } catch (HttpRequestException e) { Console.WriteLine($"Error: {e.Message}"); } } }
In this code, we define a simple program with a single method `IdentifyDocumentLanguages`.
This method first sets up the authentication header by adding the bearer token to the HttpClient's default headers.
Then, it creates the request body containing the document text.
It sends a POST request to the specified endpoint with the request body as JSON.
If the request fails for any reason, an HttpRequestException will be thrown and the method will catch it and print the error message to the console.
If the request is successful, the method will read the response body as an array of `IdentifyLanguage` objects and print the language code and probability for each identified language.
Request Body:
text
: The document text to identify the languages.