synonym.json
Overview
synonym.json is a JSON file that serves as a comprehensive bilingual mapping dictionary. It primarily provides mutual mappings between Chinese company names and their corresponding stock or company codes. Additionally, it includes mappings of Chinese temporal terms and weekday names to their synonyms or abbreviations. This file functions as a key-value store enabling quick lookup of equivalent terms, facilitating tasks such as data normalization, synonym resolution, and entity recognition in financial or business data processing.
The core utility of this file lies in its bidirectional mappings: every Chinese company name maps to a unique code string, and each code string maps back to the company name. This redundancy allows for efficient conversion between the two representations. Similarly, common Chinese temporal words and weekday names are mapped to their synonyms or abbreviations, supporting natural language processing or user interface localization.
File Content and Structure
The file is a single JSON object.
Keys and values are strings or arrays of strings.
The majority of entries are pairs of company names and their stock codes, with reciprocal entries for reverse lookup.
Some entries represent synonyms for temporal expressions (e.g., "去年" / "前年" / "今年") and weekdays ("周一" → ["礼拜一", "星期一"]).
A few words like "上班" are mapped to simpler terms like "办公".
Example Entries
{
"阿为特": "873693",
"873693": "阿为特",
"去年": "2024",
"前年": "2023",
"今年": "2025",
"上季度": ["一季度", "q1"],
"q1": "一季度",
"周一": ["礼拜一", "星期一"],
"周日": ["礼拜日", "星期日", "星期天", "礼拜天"],
"上班": "办公"
}
Detailed Explanation of Content
Company Name and Code Mappings
Purpose: To provide a quick lookup between company names and their official stock codes.
Format:
Forward mapping:
"CompanyName": "Code"Reverse mapping:
"Code": "CompanyName"
Usage Example:
{ "阿为特": "873693", "873693": "阿为特" }This allows software to:
Retrieve the code
"873693"given the company name"阿为特".Retrieve the company name
"阿为特"given the code"873693".
Scope: The dataset includes thousands of such mappings, likely covering a broad set of companies listed on Chinese stock exchanges or significant entities.
Temporal Terms and Synonyms
Purpose: To normalize or resolve different expressions of time periods and days of the week.
Format:
Terms mapped to equivalent or synonymous expressions, sometimes as arrays.
Examples:
Year terms:
{ "去年": "2024", "前年": "2023", "今年": "2025" }Quarter terms:
{ "上季度": ["一季度", "q1"], "q1": "一季度", "q2": "二季度", "q3": "三季度", "q4": "四季度" }Weekdays with synonyms:
{ "周一": ["礼拜一", "星期一"], "周日": ["礼拜日", "星期日", "星期天", "礼拜天"] }Other synonyms:
{ "上班": "办公" }
Usage: This allows a system to interpret various user inputs expressing the same time concepts uniformly.
Implementation Details and Algorithms
The file is a static JSON dictionary without any executable code, classes, or functions.
Its primary role is as a data resource for other software components.
The bidirectional mappings for companies are explicitly defined: each key-value pair has a corresponding inverse pair.
Synonyms are stored as arrays for keys like weekdays and quarters to capture multiple variants.
The dataset appears to be manually curated or generated from authoritative sources, ensuring coverage of many entities and terms.
There is no embedded algorithm, but typical uses may include:
Lookup operations for code/name resolution.
Synonym replacement for natural language processing.
Data cleaning or standardization in financial or business applications.
Interaction with Other Parts of a System or Application
Typically,
synonym.jsonwould be loaded by application modules responsible for:Entity recognition and normalization: Converting company names or codes into a canonical form.
User input parsing: Interpreting dates, quarters, or weekdays expressed in various synonymous forms.
Data integration: Matching external data sources using either codes or names.
Search or filtering: Allowing queries with either names or codes interchangeably.
It can be used as a lookup dictionary in:
Web services or APIs that accept company identifiers.
Financial analysis tools displaying company information.
Localization or language processing modules.
Usage Examples
Example 1: Lookup Company Code by Name
import json
# Load the synonym dictionary
with open("synonym.json", "r", encoding="utf-8") as f:
synonyms = json.load(f)
company_name = "阿为特"
company_code = synonyms.get(company_name)
print(f"Company code for {company_name} is {company_code}")
# Output: Company code for 阿为特 is 873693
Example 2: Lookup Company Name by Code
code = "873693"
name = synonyms.get(code)
print(f"Company name for code {code} is {name}")
# Output: Company name for code 873693 is 阿为特
Example 3: Normalize Weekday Name
weekday_input = "礼拜一"
# Reverse lookup: find the standard key for this synonym
standard_weekday = None
for key, synonyms_list in synonyms.items():
if isinstance(synonyms_list, list) and weekday_input in synonyms_list:
standard_weekday = key
break
print(f"Standard weekday for '{weekday_input}' is '{standard_weekday}'")
# Output: Standard weekday for '礼拜一' is '周一'
Visual Diagram
Since synonym.json is a utility data file containing key-value mappings, a flowchart showing the main types of mappings and their relationships is suitable.
flowchart TD
A[Company Name] <--> B[Company Code]
C[Temporal Terms] --> D[Synonyms List]
E[Weekday Names] --> F[Synonyms List]
G[Other Terms] --> H[Synonyms or Equivalent]
style A fill:#f9f,stroke:#333,stroke-width:1px
style B fill:#f9f,stroke:#333,stroke-width:1px
style C fill:#bbf,stroke:#333,stroke-width:1px
style D fill:#bbf,stroke:#333,stroke-width:1px
style E fill:#bbf,stroke:#333,stroke-width:1px
style F fill:#bbf,stroke:#333,stroke-width:1px
style G fill:#bbf,stroke:#333,stroke-width:1px
style H fill:#bbf,stroke:#333,stroke-width:1px
Company Name <--> Company Code: Bidirectional mapping for entity identification.
Temporal Terms → Synonyms List: One-to-many mapping for time expressions.
Weekday Names → Synonyms List: One-to-many mapping for weekdays.
Other Terms → Synonyms or Equivalent: Miscellaneous synonyms.
Summary
synonym.json is an extensive, bidirectional synonym dictionary primarily mapping Chinese company names to their stock codes and vice versa. It also includes important temporal and weekday synonyms, facilitating natural language understanding and data normalization in financial and business applications. The file serves as a foundational reference for systems requiring consistent entity resolution and synonym handling.
If integrating this file into a project, it should be loaded as a lookup dictionary used for:
Validating and converting company identifiers.
Normalizing input text for temporal references.
Supporting multilingual or synonym-aware search.
No executable code is embedded; its value lies in the comprehensive and structured data it provides.