From Classic Film Actor Profiles to Structured Knowledge Modeling: Organizing Film Character Information

    In film-related applications, cast information is often stored as unstructured narrative text. This article explores how to transform this high-density, unstructured data into structured, verifiable, and reusable knowledge assets. It covers problem analysis, entity modeling, key information extraction techniques such as date parsing and entity alignment, data quality validation, and the derived application value of building a structured knowledge graph for film characters.

    In film-related applications, cast information for a classic movie often exists as large blocks of narrative text. Take a 1934 French film adapted from a literary masterpiece as an example. Its lead actor’s profile contains rich information such as birth and death dates, birthplace, representative works, collaborating directors, and career history. While this format is reader-friendly, it is highly unfriendly to programmatic processing: fields are scattered across free text, and implicit relationships exist between entities. Using such profiles as a sample, this article discusses how to transform them into structured, verifiable, and reusable knowledge data.

    1. Problem Analysis: Pain Points of Unstructured Text

    Raw character profiles typically exhibit the following characteristics:

    • High information density but messy format: Birth and death dates, birthplace, and representative works are mixed within the same paragraph, such as “Actor A, born on November 22, 1874, died on June 2, 1943, born in Paris, representative works include…”
    • Implicit entity relationships: The connections between actors and directors or films are expressed through sentences like “starred in a film directed by X,” which requires semantic parsing to extract.
    • Incomplete and inconsistent data: Some actors have precise birth and death dates, while others only have names and job descriptions. Date formats might be “1934” or “1934 played role X,” showing obvious granularity differences.
    • Multilingual mixing: Character names often have both original spellings and translated names. For instance, an actor might be labeled with both their foreign original name and a phonetic translation, which requires entity alignment.

    These issues dictate that storing raw text directly is unfeasible; a normalized model must be established.

    2. Entity Modeling Design

    For film character profiles, it is recommended to abstract four core entities:

    1. Person: Actors, directors, etc. Core attributes include native name, translated name, birth date, death date, birthplace, and occupation.
    2. Work: Films, theatrical works. Attributes include title, foreign title, release year, and genre.
    3. Organization: Theaters, troupes, etc., such as an actor “becoming a pillar of a theater” or “joining a troupe led by a director.”
    4. Participation (Relationship): Edges between Person and Work, carrying attributes like role name and duty (actor/director).

    A simplified data structure example is as follows:

    1. {
    2. "person": {
    3. "id": "person_001",
    4. "name_zh": "Actor A",
    5. "name_orig": "Person A",
    6. "birth_date": "1874-11-22",
    7. "death_date": "1943-06-02",
    8. "birth_place": "Paris",
    9. "nationality": "France",
    10. "careers": ["film", "theater"]
    11. },
    12. "works": [
    13. {
    14. "id": "work_001",
    15. "title_zh": "A Film",
    16. "year": 1934,
    17. "genres": ["drama"]
    18. }
    19. ],
    20. "participations": [
    21. {
    22. "person_id": "person_001",
    23. "work_id": "work_001",
    24. "role": "Homais",
    25. "duty": "actor"
    26. }
    27. ]
    28. }

    This “entity + relationship” design aligns with the modeling philosophy of knowledge graphs and naturally supports queries like “find all actors who collaborated with a specific director in the 1930s.”

    3. Key Steps in Information Extraction

    3.1 Date Parsing and Normalization

    Date expressions in character profiles are diverse and require a unified parsing strategy:

    1. import re
    2. from datetime import date
    3. DATE_PATTERNS = [
    4. (r"(\d{4})年(\d{1,2})月(\d{1,2})日", "%Y-%m-%d"), # Precise date
    5. (r"(\d{4})年", None), # Year only
    6. ]
    7. def parse_date(text):
    8. m = re.match(r"(\d{4})年(\d{1,2})月(\d{1,2})日", text)
    9. if m:
    10. y, mo, d = map(int, m.groups())
    11. return date(y, mo, d).isoformat()
    12. m = re.match(r"(\d{4})年", text)
    13. if m:
    14. return m.group(1) # Degrade to year granularity
    15. return None

    Note the importance of preserving time granularity: when only the year is known, month and day should not be fabricated, as this would introduce errors in sorting and statistics.

    3.2 Entity Disambiguation and Alias Alignment

    The same person may appear under both their “native name” and “translated name.” For example, an actor’s native name might be a long foreign name, while translated profiles often use abbreviations or phonetic translations. In practice, an alias table should be established to map all titles to a unified entity ID. For namesakes, context features such as birth year, nationality, and collaboration circles (e.g., “frequently co-starred with a famous actor”) can be used to assist disambiguation.

    3.3 Lifecycle Event Modeling

    Actor profiles often contain career milestones: first screen appearance, career peak, late representative works, death, etc. It is recommended to abstract these into a sequence of timestamped events:

    1. {
    2. "person_id": "person_001",
    3. "events": [
    4. {"year": 1908, "type": "debut", "desc": "First film appearance"},
    5. {"year": 1934, "type": "career_peak", "desc": "Starred in multiple representative works"},
    6. {"year": 1941, "type": "late_work", "desc": "Starred in late representative work"},
    7. {"year": 1943, "type": "death"}
    8. ]
    9. }

    The advantage of event-based modeling is that it supports timeline visualization and makes it easy to calculate derived attributes such as “active era intervals.”

    4. Data Quality Validation

    After structuring, validation rules must be established to prevent dirty data from entering the database:

    • Date consistency: The death date must be later than the birth date; the work year should fall within the person’s active period. For example, if an actor died in 1943, the year of any work they participated in should not be later than that year.
    • Referential integrity: The person_id and work_id in participation records must exist in the corresponding entity tables.
    • Tiered required fields: Name and ID are mandatory; birth and death dates can degrade to year granularity; birthplace and similar fields are allowed to be missing.
    • Enum constraints: Work genres (comedy, drama, etc.) and duty types should use controlled vocabularies to avoid synonym variants like “drama film” vs. “drama.”

    The core validation logic can be expressed with the following pseudo-code:

    1. def validate(person, participations, works):
    2. if person.death_date and person.birth_date:
    3. assert person.death_date > person.birth_date, "Birth and death dates conflict"
    4. work_years = {w.id: w.year for w in works}
    5. death_year = person.death_date.year if person.death_date else None
    6. for p in participations:
    7. if death_year and work_years[p.work_id] > death_year:
    8. raise ValueError(f"Work year exceeds active period: {p.work_id}")

    5. Derived Application Value

    Once structured, this data can support various application scenarios:

    1. Character relationship graph: Intuitively displays the collaboration network between directors and actors. For example, the clustering phenomenon where a prolific director collaborates multiple times with the same group of actors in the 1930s naturally emerges.
    2. Era-based retrieval: Filter characters by their active era to quickly locate representative film figures from a specific period.
    3. Automated profile generation: The same structured data can simultaneously drive web, mobile, and API outputs, avoiding inconsistencies from maintaining multiple sources.
    4. Data enrichment and fusion: Missing fields (e.g., an actor with only a job description but no birth/death information) can be supplemented from other data sources via entity alignment, provided the data source and confidence level are noted.

    6. Conclusion

    The technical processing of film character profiles is essentially a complete pipeline: “text understanding — entity modeling — relationship extraction — quality validation — application output.” There are three core takeaways: first, preserve time granularity without faking precision; second, use “entities + participation relationships” instead of flat fields to make implicit connections explicit; third, establish controlled vocabularies and validation rules to ensure long-term data maintainability. This methodology is not only applicable to the film domain but can also be extended to any knowledge data organization scenario centered around people, helping developers extract reliable and reusable knowledge assets from messy narrative texts.