Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

PunGraph

A compact collection of English pun data and phonetic-similarity resources for pun detection, interpretation, generation, and retrieval experiments.

Repository contents

Pun-Inference-Public/
├── KG/
│   └── phonetic_similarity_table_replaced_cleaned.txt
├── WebDataset/
│   ├── final_heter.json
│   └── final_homo.json
└── README.md
File Records Description
WebDataset/final_homo.json 669 Homographic puns: one written form evokes multiple meanings.
WebDataset/final_heter.json 5,061 Heterographic puns: the observed pun word and intended word have different spellings.
KG/phonetic_similarity_table_replaced_cleaned.txt 760,311 Pipe-delimited word pairs with a phonetic-similarity score.

Data format

Homographic puns

final_homo.json contains a top-level data array. Each item has the following fields:

Field Type Description
id integer Record identifier.
sentence string Sentence or joke containing the pun.
Pun string Pun-bearing word or expression.
pun_word string The two meanings evoked by the pun, separated by a comma.

Example:

{
  "id": 1,
  "sentence": "A baseball player can sell himself to a new team if he has a good pitch.",
  "Pun": "pitch",
  "pun_word": "throw, sales proposal"
}

Heterographic puns

final_heter.json also contains a top-level data array.

Field Type Description
id integer Record identifier.
sentence string Sentence containing the substituted pun form.
Pun string Word form that appears in the sentence.
Real string Contextually intended or conventional word form.

Example:

{
  "id": 1,
  "sentence": "Make like a banana and spit",
  "Pun": "spit",
  "Real": "split"
}

Phonetic similarity table

phonetic_similarity_table_replaced_cleaned.txt contains one pair per line:

word_1|word_2|similarity_score

The score ranges from 0.2 to 1.0 in the current release, where a larger value indicates greater phonetic similarity.

a-bomb|bomb|0.75
a-bomb|h-bomb|0.8333333333333334

Quick start

No package installation is required to inspect the data. Clone the repository and load the JSON files with Python's standard library:

git clone https://github.com/ysu132/Pun-Inference-Public.git
cd Pun-Inference-Public
import json
from pathlib import Path

root = Path("WebDataset")

with (root / "final_homo.json").open(encoding="utf-8") as file:
    homographic = json.load(file)["data"]

with (root / "final_heter.json").open(encoding="utf-8") as file:
    heterographic = json.load(file)["data"]

print(f"Homographic examples: {len(homographic):,}")
print(f"Heterographic examples: {len(heterographic):,}")
print(heterographic[0])

Read the similarity table as a stream so the entire file does not need to be loaded into memory:

from pathlib import Path

table = Path("KG/phonetic_similarity_table_replaced_cleaned.txt")

with table.open(encoding="utf-8") as file:
    for line in file:
        word_1, word_2, score = line.rstrip("\n").split("|")
        score = float(score)
        # Use the pair here.

Notes

  • The data is in English.
  • Field names are case-sensitive (Pun and Real).
  • Record IDs are local to each JSON file; do not assume they are globally unique across the repository.
  • Review and normalize the data as appropriate before using it in production or model evaluation.

Citation

If you use this repository in your work, please cite the repository URL. A formal paper citation will be added here when available.

License

No license file is currently included. Until a license is added, the repository does not grant permission to copy, modify, or redistribute its contents beyond what is allowed by applicable law. Please contact the repository owner for usage terms.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors