Skip to content

Instantly share code, notes, and snippets.

@boydkelly
Created April 21, 2021 09:50
Show Gist options
  • Save boydkelly/4d772b2f35c4c6c0328e739a8249fa47 to your computer and use it in GitHub Desktop.
Save boydkelly/4d772b2f35c4c6c0328e739a8249fa47 to your computer and use it in GitHub Desktop.
extended character issue
{
"$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A word cloud visualization depicting Vega research paper abstracts.",
"width": 800,
"height": 400,
"padding": 0,
"data": [
{
"name": "table",
"values": [
"O kɛnin, masacɛ ka so san sɔngɔ gbɛlɛn na., A ka so bla kuru dɔ kɔnɔ, ni so ka bo min kɛ, o bɛ o cɛ fɔ so nan na bo caman kɛ., O ka sɔrɔ cɛ se l",
"O senin masacɛ fɛ, masacɛ ko: «+Ile ka so min feere n ma ko a bo ye sanu ye, sanu wɛrɛ ma sɔrɔ a kɔnɔ fɔ sanukurukelen.+» , Cɛ muso ko: «+Eh+! I",
"Masacɛ ka misitura, san woronfila tura le kan tigɛ ka o gbolo bɔ a la. O ka galontigɛla bla gbolo nin kɔnɔ ka a karan a da la.",
"O b’a fɛ ka a fili baji kɔnɔ., O se la bada la minkɛ, mankanba dɔ le wili la so kɔnɔ., O ka ale jigi ka taga o konyanw nyanabɔ sabu olugu ye mas",
"Tele damandaman timi na minkɛ, namaratɔ nan na bɔ masacɛ ye., A ko : «+Laharakaw bɛ i fo, tɔrɔ si tɛ o la., I mɔncɛ b’i fo., I nyanafin bɛ o la"
],
"transform": [
{
"type": "countpattern",
"field": "data",
"case": "upper",
"pattern": "[\\w']{3,}",
"stopwords": "(i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|i'm|you're|he's|she's|it's|we're|they're|i've|you've|we've|they've|i'd|you'd|he'd|she'd|we'd|they'd|i'll|you'll|he'll|she'll|we'll|they'll|isn't|aren't|wasn't|weren't|hasn't|haven't|hadn't|doesn't|don't|didn't|won't|wouldn't|shan't|shouldn't|can't|cannot|couldn't|mustn't|let's|that's|who's|what's|here's|there's|when's|where's|why's|how's|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall)"
},
{
"type": "formula",
"as": "angle",
"expr": "[-45, 0, 45][~~(random() * 3)]"
},
{
"type": "formula",
"as": "weight",
"expr": "if(datum.text=='VEGA', 600, 300)"
}
]
}
],
"scales": [
{
"name": "color",
"type": "ordinal",
"domain": {"data": "table", "field": "text"},
"range": ["#d5a928", "#652c90", "#939597"]
}
],
"marks": [
{
"type": "text",
"from": {"data": "table"},
"encode": {
"enter": {
"text": {"field": "text"},
"align": {"value": "center"},
"baseline": {"value": "alphabetic"},
"fill": {"scale": "color", "field": "text"}
},
"update": {"fillOpacity": {"value": 1}},
"hover": {"fillOpacity": {"value": 0.5}}
},
"transform": [
{
"type": "wordcloud",
"size": [800, 400],
"text": {"field": "text"},
"rotate": {"field": "datum.angle"},
"font": "Helvetica Neue, Arial",
"fontSize": {"field": "datum.count"},
"fontWeight": {"field": "datum.weight"},
"fontSizeRange": [12, 56],
"padding": 2
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment