Last active
November 27, 2024 11:23
Revisions
-
nitaku revised this gist
Sep 21, 2015 . 9 changed files with 10556 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,45 @@ John Christopher "Johnny" Depp II (born June 9, 1963) is an American actor, producer, and musician. He has won the Golden Globe Award and Screen Actors Guild Award for Best Actor. He rose to prominence on the 1980s television series 21 Jump Street, becoming a teen idol. Since then, Depp has taken on challenging and "larger-than-life" roles, starting with a supporting role in Oliver Stone's Vietnam War film Platoon in 1986, then playing the title character in the romantic dark fantasy Edward Scissorhands (1990). He later found box office success in the fantasy adventure film Sleepy Hollow (1999), the fantasy swashbuckler film Pirates of the Caribbean: The Curse of the Black Pearl (2003) and its sequels, the musical adventure film Charlie and the Chocolate Factory (2005), the fantasy film Alice in Wonderland (2010) and voicing the title character in the animated action comedy western Rango (2011). He has collaborated on eight films with director and friend Tim Burton. Depp is regarded as one of the world's biggest movie stars. He has gained worldwide critical acclaim for his portrayals of such people as screenwriter-director Ed Wood in Ed Wood, undercover FBI agent Joseph D. Pistone in Donnie Brasco, "gonzo" journalist Hunter S. Thompson in Fear and Loathing in Las Vegas, cocaine kingpin George Jung in Blow, Peter Pan author J. M. Barrie in Finding Neverland, and the Depression Era outlaw John Dillinger in Michael Mann's Public Enemies. Films featuring Depp have grossed over $3.1 billion at the United States box office and over $7.6 billion worldwide. His most commercially successful films are the Pirates of the Caribbean films, which have grossed $3 billion; Alice in Wonderland which grossed $1 billion; Charlie and the Chocolate Factory which grossed $474 million; and The Tourist which grossed $278 million worldwide. Depp has been nominated for major acting awards, including three nominations for Academy Award for Best Actor. Depp won the Golden Globe Award for Best Actor – Motion Picture Musical or Comedy for Sweeney Todd: The Demon Barber of Fleet Street and the Screen Actors Guild Award for Outstanding Performance by a Male Actor in a Leading Role for Pirates of the Caribbean: The Curse of the Black Pearl. He has been listed in the 2012 Guinness World Records as the highest paid actor, with earnings of $75 million. Depp was inducted as a Disney Legend in 2015. Depp was born in Owensboro, Kentucky, the youngest of four children of Betty Sue Palmer (née Wells), a waitress, and John Christopher Depp, a civil engineer. Depp moved frequently during his childhood. He and his siblings lived in more than 20 different places, eventually settling in Miramar, Florida in 1970. In 1978, when he was 15, Depp's parents divorced. His mother remarried to Robert Palmer (died 2000), whom Depp has called "an inspiration to me". With the gift of a guitar from his mother when he was 12, Depp began playing in various garage bands. A year after his parents' divorce, Depp dropped out of high school to become a rock musician. He attempted to go back to school two weeks later, but the principal told him to follow his dream of being a musician. He played with The Kids, a band that enjoyed modest local success. The Kids set out together for Los Angeles in pursuit of a record deal, changing their name to Six Gun Method, but the group split up before signing a record deal. Depp subsequently collaborated with the band Rock City Angels and co-wrote their song "Mary", which appeared on Rock City Angels' debut Geffen Records album, Young Man's Blues. On December 20, 1983 Depp married Lori Anne Allison, the sister of his band's bass player and singer. During their marriage she worked as a makeup artist while he worked a variety of odd jobs, including a telemarketer for pens. His wife introduced him to actor Nicolas Cage, who advised Depp to pursue an acting career. Depp and his wife divorced in 1985. Both Depp and his subsequent fiancée Sherilyn Fenn auditioned for the 1986 film Thrashin'. They were both cast, with Depp being chosen by the film's director to star as the lead, which would have been Depp's second major role. Depp was later turned down by the film's producer, who rejected the director's decision. Depp's first major role was in the 1984 classic horror film A Nightmare on Elm Street, as the boyfriend of heroine Nancy Thompson (played by Heather Langenkamp) and one of Freddy Krueger's victims. The director of the 1986 American skating drama Thrashin' then cast Depp for the film's lead role; however, his decision was later overridden by the film's producer. In 1986, Depp appeared in a secondary role as a Vietnamese-speaking private in Oliver Stone's Platoon. Depp's first release in 1990 was Cry-Baby. Although the film did not achieve high audience numbers upon its initial release, over the years it has gained a cult classic status. Depp's next release that year saw him undertake the quirky title role of Tim Burton's film Edward Scissorhands, a critical and commercial success that established Depp as leading Hollywood actor and began his long association with Burton. In 1994, Depp played the title role in Tim Burton's comedy-drama biographical film, Ed Wood, about one of history's most inept film directors. It received immense critical acclaim, with Janet Maslin of The New York Times writing that Depp had "proved himself as an established, certified great actor" and "captured all the can-do optimism that kept Ed Wood going, thanks to an extremely funny ability to look at the silver lining of any cloud." Depp was nominated for Golden Globe Award for Best Actor – Motion Picture Musical or Comedy for his performance. In 1995 Depp starred in three films. He played opposite Marlon Brando in the box-office hit Don Juan DeMarco, as a man who believes he is Don Juan, the world's greatest lover. He next appeared in Dead Man, a Western shot entirely in black-and-white; it did poor business and had mixed critical reviews. Depp then appeared in the financial and critical failure Nick of Time, playing an accountant who is told to kill a politician to save his kidnapped daughter. The 2003 Walt Disney Pictures film Pirates of the Caribbean: The Curse of the Black Pearl was a major success, in which Depp's performance as the suave but shambling pirate Captain Jack Sparrow was highly praised. Studio bosses were more ambivalent at first, but the character became popular with the movie-going public. According to a survey taken by Fandango, Depp was a major draw for audiences. The film's director, Gore Verbinski, has said that Depp's character closely resembles the actor's personality, but Depp said he modeled the character after The Rolling Stones' guitarist Keith Richards and cartoon skunk Pepé Le Pew. Depp was nominated for an Academy Award for Best Actor for the role. In 2004, Depp was again nominated for the Best Actor Academy Award for his performance as Scottish author J. M. Barrie in the film Finding Neverland. He next starred as Willy Wonka in 2005's Charlie and the Chocolate Factory, a major box-office success that earned him a nomination for the Golden Globe Award for Best Actor in a Musical or Comedy. Depp reprised the role of Jack Sparrow in the Pirates sequels Dead Man's Chest (2006), At World's End (2007) and On Stranger Tides (2011), each of which were major successes as well. Depp has said that Sparrow is "definitely a big part of me", and he even voiced the character in the video game Pirates of the Caribbean: The Legend of Jack Sparrow. The swashbuckling sword talents Depp acquired for his role as Sparrow were highlighted in the documentary film Reclaiming the Blade. In the film, swordmaster Bob Anderson shared his experiences working with Depp on the choreography for The Curse of the Black Pearl, and described Depp's abilities as a sword-wielding actor to be "about as good as you can get." Depp and Gore Verbinski were executive producers of the album Rogues Gallery, Pirate Ballads, Sea Songs and Chanteys. Depp played the title role of Sweeney Todd in Tim Burton's film adaptation of the musical, for which he won a Golden Globe Award for Best Actor – Motion Picture Musical or Comedy. Depp thanked the Hollywood Foreign Press Association and praised Tim Burton for his "unwavering trust and support." In director Terry Gilliam's 2009 film The Imaginarium of Doctor Parnassus, Depp, Jude Law and Colin Farrell each played the character initially portrayed by their friend Heath Ledger, who died before the film was completed. All three actors gave their salaries to Ledger's daughter, Matilda. Depp played the Mad Hatter in Burton's 2010 re-imagining of Alice in Wonderland, and the protagonist in the 2011 animated film Rango. Depp played convicted Boston crime boss Whitey Bulger in director Scott Cooper's Black Mass (2015). Depp has collaborated with director and close friend Tim Burton in films, beginning with Edward Scissorhands (1990), opposite Winona Ryder and Vincent Price. His next role with Burton was in the 1994 film Ed Wood. Depp later said that "within 10 minutes of hearing about the project, I was committed." At the time, the actor was depressed about films and filmmaking. This part gave him a "chance to stretch out and have some fun"; he said working with Martin Landau "rejuvenated my love for acting". Producer Scott Rudin once said "Basically Johnny Depp is playing Tim Burton in all his movies", although Burton personally disapproved of the comment. Depp, however, agrees with Rudin's statement. According to Depp, Edward Scissorhands represented Burton's inability to communicate as a teenager. Ed Wood reflected Burton's relationship with Vincent Price (very similar to Edward D. Wood, Jr. and Bela Lugosi). Depp's next venture with Burton was the role of Ichabod Crane in Sleepy Hollow (1999), opposite Christina Ricci. Sleepy Hollow reflected Burton's battle with the Hollywood studio system. For his performance, Depp took inspiration from Angela Lansbury, Roddy McDowall and Basil Rathbone. Depp stated, "I always thought of Ichabod as a very delicate, fragile person who was maybe a little too in touch with his feminine side, like a frightened little girl." Depp did not work with Burton again until 2005 in Charlie and the Chocolate Factory, in which he played Willy Wonka. The film was a box office success and received positive critical reception. Gene Wilder, who played Willy Wonka in the 1971 film, initially criticized this version. Charlie and the Chocolate Factory was released in July, followed by Corpse Bride, for which Depp voiced the character Victor Van Dort, in September. Sweeney Todd: The Demon Barber of Fleet Street (2007) followed, bringing Depp his second major award win, the Golden Globe Award for Best Actor – Motion Picture Musical or Comedy as well as his third nomination for the Academy Award for Best Actor. Burton first gave him an original cast recording of the 1979 stage musical in 2000. Although not a fan of the musical genre, Depp grew to like the tale's treatment. He cited Peter Lorre in Mad Love (1935) as his main influence for the role, and practiced the songs his character would perform while filming Pirates of the Caribbean: At World's End. Although he had performed in musical groups, Depp was initially unsure that he would be able to sustain Stephen Sondheim's lyrics. Depp recorded demos and worked with Bruce Witkin to shape his vocals without a qualified voice coach. In the DVD Reviews section, Entertainment Weekly's Chris Nashawaty gave the film an A minus, stating, "Depp's soaring voice makes you wonder what other tricks he's been hiding ... Watching Depp's barber wield his razors ... it's hard not to be reminded of Edward Scissorhands frantically shaping hedges into animal topiaries 18 years ago ... and all of the twisted beauty we would've missed out on had [Burton and Depp] never met." In his introduction to Burton on Burton, a book of interviews with the director, Depp called Burton "... a brother, a friend, ... and [a] brave soul". The next Depp-Burton collaboration was Alice in Wonderland (2010). Depp played the Mad Hatter alongside Helena Bonham Carter, Anne Hathaway and Alan Rickman. In 2012, he starred in the Burton-directed Dark Shadows, a film based on the 1966–1971 gothic soap opera of the same name, alongside fellow Tim Burton regular Helena Bonham Carter, as well as Michelle Pfeiffer and Eva Green. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ Daniel Robert "Danny" Elfman (born May 29, 1953) is an American composer, singer, songwriter, and record producer. He is known as the lead singer and songwriter for the rock band Oingo Boingo, from 1976 to 1995 and later for scoring music for television and film and creating The Simpsons main title theme as well as the 1989 Batman film theme. He has scored the majority of his long-time friend Tim Burton's films. Elfman re-entered the film industry in 1976, initially as an actor. He made his film scoring debut in 1982 for the film Forbidden Zone directed by his older brother Richard Elfman. He has since been nominated for four Academy Awards and won a Grammy Award for Best Instrumental Composition Written for a Motion Picture, Television or Other Visual Media for Tim Burton's Batman and an Emmy Award for his Desperate Housewives theme. Elfman was honored with the Richard Kirk Award at the 2002 BMI Film and TV Awards; the award is given annually to a composer who has made significant contributions to film and television music. He was also inducted as a Disney Legend in 2015. Danny Elfman was born in Los Angeles, California, into a Jewish family. He is the son of Blossom Elfman (née Bernstein), a writer and teacher, and Milton Elfman, a teacher who was in the Air Force. He was raised in a racially mixed community in the Baldwin Hills area of Los Angeles. He spent much of his time in the local movie theatre, adoring the music of such film composers as Bernard Herrmann and Franz Waxman. Stating that he hung out with the "band geeks" in high school, he started a ska band. After dropping out of high school, he followed his brother Richard to France, where he performed with Le Grand Magic Circus, an avant-garde musical theater group. Violin in tow, Elfman next journeyed to Africa where he traveled through Ghana, Mali, and Upper Volta, absorbing new musical styles, including the Ghanaian highlife genre which would eventually influence his own music.[citation needed] He contracted malaria during his one-year stay and was often sick. Eventually he returned home to the United States, where he began to take Balinese music lessons at CalArts. During this time, he was romantically involved with Kim Gordon, who would later go on to form Sonic Youth. He was never officially a student at the institute; nonetheless, the instructor encouraged him to continue learning. Elfman stated, "He just laughed, and said, 'Sit. Play.' I continued to sit and play for a couple years." At this time, his brother was forming a new musical theater group. In 1972 Richard Elfman founded the American new wave band/performance art group, originally called The Mystic Knights of the Oingo Boingo. They played several shows throughout the 1970s until Richard Elfman left the band to become a filmmaker. As a send-off to the band's original concept, Richard Elfman created the film Forbidden Zone based on their stage performances. Danny Elfman composed his first score for the film and played the role of Satan (the other band members played his minions). By the time the movie was completed, they had taken the name Oingo Boingo and begun recording and touring as a rock group. From 1976 and on, it was led by Danny Elfman, until 1995 when they suddenly retired. The semi-theatrical music and comedy troupe had transformed into a ska-influenced new wave band in 1979, and then changed again towards a more guitar-oriented rock sound, in the late 1980s.[citation needed]. Oingo Boingo, still led by Danny Elfman, performed as themselves in the 1986 movie Back to School. In 1985, Tim Burton and Paul Reubens invited Elfman to write the score for their first feature film, Pee-wee's Big Adventure. Elfman was apprehensive at first because of his lack of formal training, but with orchestration assistance from Oingo Boingo guitarist and arranger Steve Bartek, he achieved his goal of emulating the mood of such composers as Nino Rota and Bernard Herrmann. In the booklet for the first volume of Music for a Darkened Theatre, Elfman described the first time he heard his music played by a full orchestra as one of the most thrilling experiences of his life. Elfman immediately developed a rapport with Burton and has gone on to score all but two of Burton's major studio releases: Ed Wood which was under production while Elfman and Burton were having a serious disagreement, and Sweeney Todd. Elfman also provided the singing voice for Jack Skellington in Tim Burton's The Nightmare Before Christmas and the voices of both Barrel and the "Clown with the Tear-Away Face". Years later he provided the voice for Bonejangles the skeleton in Corpse Bride. Burton has said of his relationship with Elfman: "We don't even have to talk about the music. We don't even have to intellectualize – which is good for both of us, we're both similar that way. We're very lucky to connect" (Breskin, 1997). Modern classicist composers, including Béla Bartók, Philip Glass, Lou Harrison, Carl Orff, Harry Partch, Sergei Prokofiev, Maurice Ravel, Erik Satie, Igor Stravinsky, and Pyotr Ilyich Tchaikovsky have influenced the style of Elfman's music. Elfman cited his first time noticing film music being when he heard Bernard Hermann's score to The Day the Earth Stood Still as an eleven-year-old and being a fan of film music since then. Other influences based in film music include Erich Wolfgang Korngold, Max Steiner, David Tamkin, and Franz Waxman. Also, Nino Rota served as a significant influence and was the main inspiration for Elfman's score to Pee-wee's Big Adventure. When asked during a 2007 phone-in interview on XETRA-FM if he ever had any notions of performing in an Oingo Boingo reunion, Elfman immediately rejected the idea and stated that in the last few years with the band he had begun to develop significant and irreversible hearing damage as a result of his continuous exposure to the high noise levels involved in performing in a rock band. He went on to say that he believes his hearing damage is partially due to a genetic predisposition to hearing loss, and that he will never return to the stage for fear of worsening not only his condition but also that of his band mates. Elfman recently composed the music for the Cirque du Soleil Show Iris, which was performed at the Dolby Theatre in Hollywood. The production began on July 21, 2011, and ended on January 19, 2013. This is Elfman's most significant non-film work since he composed Serenada Schizophrana for the American Composers Orchestra. It was conducted by John Mauceri on its recording and by Steven Sloane at its premiere at Carnegie Hall in New York City on February 23, 2005. After its premiere, it was recorded in studio and released onto SACD on October 3, 2006. The meeting with Mauceri proved fruitful as the composer was encouraged then to write a new concert piece for Mauceri and the Hollywood Bowl Orchestra. Elfman composed an "overture to a non-existent musical" and called the piece "The Overeager Overture". He also continues to compose his film scores in addition to these other projects. In November 2010, it was reported that Danny Elfman is writing the music for a planned musical based on the life of Harry Houdini. But, as of January 2012, he was no longer attached to the project. In October 2013, Elfman returned to the stage to sing his vocal parts to a handful of Nightmare Before Christmas songs as part of a concert titled Danny Elfman's Music from the Films of Tim Burton. He composed the film score for Oz the Great and Powerful (2013), and composed additional music for Avengers: Age of Ultron (2015). Elfman has three children: Lola (born 1979), Mali (born 1984), and Oliver (born 2005). On November 29, 2003, he married actress Bridget Fonda. In 1997, he scored A Simple Plan, his only score for one of her films to date (although he did compose a cue for the film Army of Darkness, in which Fonda has a cameo). In the late 1960s and early 1970s, he dated Sonic Youth's Kim Gordon. He is the uncle of actor Bodhi Elfman, who is married to actress Jenna Elfman. Describing his politics during the 1980s, Elfman said, "I'm not a doomist. My attitude is always to be critical of what's around you, but not ever to forget how lucky we are. I've traveled around the world. I left thinking I was a revolutionary. I came back real right-wing patriotic. Since then, I've kind of mellowed in between." In 2008, he expressed support for Barack Obama and said that Sarah Palin was his "worst nightmare". Elfman's scores for Batman and Edward Scissorhands were nominated for AFI's 100 Years of Film Scores. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,681 @@ word danny johnny elfman's depp depp's elfman will one two three four five six seven eight nine ten - a able about above abst accordance according accordingly across act actually added adj affected affecting affects after afterwards again against ah all almost alone along already also although always am among amongst an and announce another any anybody anyhow anymore anyone anything anyway anyways anywhere apparently approximately are aren arent aren't arise around as aside ask asking at auth available away awfully b back be became because become becomes becoming been before beforehand begin beginning beginnings begins behind being believe below beside besides between beyond biol both brief briefly but by c ca came can cannot can't cause causes certain certainly co com come comes contain containing contains could couldnt couldn't d date did didn't do does doesnt doesn't doing done dont don't down downwards due during e each ed edu effect eg eight eighty either else elsewhere end ending enough especially et et-al etc even evenly ever every everybody everyone everything everywhere except f far few ff following follows for former formerly found from further furthermore g gave get gets getting give given gives giving go goes gone got gotten h had happens hardly has hasnt hasn't have havent haven't having he hed he'd he'll hence her here hereafter hereby herein heres hereupon hers herself hes he's hi him himself his how how's howbeit however i id i'd ie if i'll im i'm immediate immediately in inc indeed index instead into inward is isnt isn't it itd it'd itll it'll its it's itself ive i've j just k keep keeps kept know known knows l largely last lately later latter latterly least less lest let lets like liked likely line little 'll look looking looks ltd m made mainly make makes many may maybe me mean means meantime meanwhile merely mg might million miss ml more moreover most mostly mr mrs much mug must my myself n na name namely nay nd near nearly necessarily necessary need needs neither never nevertheless new next no nobody non none nonetheless noone nor normally nos not noted nothing now nowhere o obviously of off often oh ok okay on once ones one's only onto or ord other others otherwise ought our ours ourselves out outside over overall owing own p part particular particularly past per perhaps please plus possible possibly potentially pp previously primarily probably promptly put q que quickly quite qv r rather rd re 're readily really recent recently ref refs regarding regardless regards related relatively respectively resulted resulting retweet rt s 's said same saw say saying says sec seem seemed seeming seems seen self selves sent several shall she she'd she'll shes she's should shouldn't showed shown showns shows significant significantly similar similarly since slightly so some somebody somehow someone somethan something sometime sometimes somewhat somewhere soon sorry specifically specified specify specifying still stop strongly sub substantially successfully such sufficiently sup 'sup sure t take taken taking tell tends th than thank thanks thanx that that'll thats that's that've the their theirs them themselves then thence there thereafter thereby thered there'd therefore therein there'll thereof therere there're theres there's thereto thereupon there've these they theyd they'd they'll theyre they're theyve they've think thinks this those thou though thoughh thousand throug through throughout thru thus til to together too took tooks toward towards tried tries truly try trying ts twice u un under unfortunately unless unlike unlikely until unto up upon ups us use used useful usefully usefulness uses using usually v value various 've very via viz vol vols vs w want wants was wasnt wasn't way we wed we'd welcome we'll well went were we're weren't we've what whatever what'll whats what's when whence whenever where whereafter whereas whereby wherein wheres where's whereupon wherever whether which while whim who whod who'd whoever whole who'll whom whomever whos who's whose why widely willing wish with within without won't words world would wouldn't x y yes yet you youd you'd youll you'll your you're youre yours yourself yourselves youve you've z This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,182 @@ svg = d3.select('svg') width = svg.node().getBoundingClientRect().width height = svg.node().getBoundingClientRect().height treemap = d3.layout.treemap() .size([width, height]) .value((node) -> node.count) .sort((a,b) -> return +1 if a.name is 'a' or b.name is 'b' return -1 if a.name is 'b' or b.name is 'a' return a.count-b.count ) .ratio(3) .padding((node) -> if node.depth is 0 return [0,0,40,0] # make room for set labels else if node.depth is 1 return 4 else return 0 ) .round(false) # bugfix: d3 wrong ordering correct_x = d3.scale.linear() .domain([0, width]) .range([0, width*1.05]) correct_y = d3.scale.linear() .domain([0, height]) .range([0, height*3/4]) # define a stable color scale to differentiate words and sets color = (txt, set) -> iset = {'a': 0, 'intersection': 1, 'b': 2}[set] Math.seedrandom(txt+'abcdef') noise = (W) -> Math.random()*W - W/2 d3.hcl(45+iset*90+noise(90), 40, 50) # translate the viewBox to have (0,0) at the center of the vis svg .attr viewBox: "#{-width/2} #{-height/2} #{width} #{height}" # append a group for zoomable content zoomable_layer = svg.append('g') # define a zoom behavior zoom = d3.behavior.zoom() .scaleExtent([1,10]) # min-max zoom .on 'zoom', () -> # GEOMETRIC ZOOM zoomable_layer .attr transform: "translate(#{zoom.translate()})scale(#{zoom.scale()})" # bind the zoom behavior to the main SVG svg.call(zoom) # group the visualization vis = zoomable_layer.append('g') .attr transform: "translate(#{-width/2},#{-height/2})" d3.csv 'english_stopwords_long.txt', (stopwords_array) -> # build an index of stopwords stopwords = {} stopwords_array.forEach (w) -> stopwords[w.word] = true d3.text 'depp.txt', (infovis_txt) -> data_a = nlp.ngram(infovis_txt, {min_count: 1, max_size: 1})[0].filter (w) -> w.word not of stopwords index_a = {} data_a.forEach (d) -> index_a[d.word] = d d3.text 'elfman.txt', (hci_txt) -> data_b = nlp.ngram(hci_txt, {min_count: 1, max_size: 1})[0].filter (w) -> w.word not of stopwords index_b = {} data_b.forEach (d) -> index_b[d.word] = d diff_a = data_a.filter (a) -> a.word not of index_b diff_b = data_b.filter (b) -> b.word not of index_a intersection = [] data_a.forEach (a) -> data_b.forEach (b) -> if a.word is b.word min = Math.min(a.count, b.count) intersection.push {word: a.word, count: min} if a.count-min > 0 diff_a.push {word: a.word, count: a.count-min} if b.count-min > 0 diff_b.push {word: b.word, count: b.count-min} a = { children: (diff_a.filter (d) -> d.count > 1), name: "a" } intersection = { children: (intersection.filter (d) -> d.count > 1), name: "intersection" } b = { children: (diff_b.filter (d) -> d.count > 1), name: "b" } tree = { children: [a,intersection,b], name: "root" } nodes_data = treemap.nodes(tree) labels = vis.selectAll('.label') .data(nodes_data.filter((node) -> node.depth is 2)) enter_labels = labels.enter().append('svg') .attr class: 'label' enter_labels.append('text') .text((node) -> node.word.toUpperCase()) .attr dy: '0.35em' fill: (node) -> color(node.word, node.parent.name) .each (node) -> bbox = this.getBBox() bbox_aspect = bbox.width / bbox.height node_bbox = {width: node.dx, height: node.dy} node_bbox_aspect = node_bbox.width / node_bbox.height rotate = bbox_aspect >= 1 and node_bbox_aspect < 1 or bbox_aspect < 1 and node_bbox_aspect >= 1 node.label_bbox = { x: bbox.x+(bbox.width-correct_x(bbox.width))/2, y: bbox.y+(bbox.height-correct_y(bbox.height))/2, width: correct_x(bbox.width), height: correct_y(bbox.height) } if rotate node.label_bbox = { x: node.label_bbox.y, y: node.label_bbox.x, width: node.label_bbox.height, height: node.label_bbox.width } d3.select(this).attr('transform', 'rotate(-90)') enter_labels .attr x: (node) -> node.x y: (node) -> node.y width: (node) -> node.dx height: (node) -> node.dy viewBox: (node) -> "#{node.label_bbox.x} #{node.label_bbox.y} #{node.label_bbox.width} #{node.label_bbox.height}" preserveAspectRatio: 'none' # draw set labels vis.append('text') .text('Johnny Depp') .attr class: 'set_label' x: a.x + a.dx/2 y: height - 22 dy: '0.35em' vis.append('text') .text('D ∩ E') .attr class: 'set_label' x: intersection.x + intersection.dx/2 y: height - 22 dy: '0.35em' vis.append('text') .text('Danny Elfman') .attr class: 'set_label' x: b.x + b.dx/2 y: height - 22 dy: '0.35em' This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ svg { background: white; } .node { shape-rendering: crispEdges; vector-effect: non-scaling-stroke; stroke: white; stroke-width: 2; } .label { pointer-events: none; text-anchor: middle; font-family: Impact; } .set_label { fill: #444; font-family: serif; font-size: 26px; text-anchor: middle; font-weight: bold; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://davidbau.com/encode/seedrandom-min.js"></script> <script src="http://d3js.org/d3.v3.min.js"></script> <script src="nlp.js"></script> <link rel="stylesheet" type="text/css" href="index.css"> <title>Word cloud intersection II</title> </head> <body> <svg width="960px" height="500px"></svg> <script src="index.js"></script> </body> </html> This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,230 @@ // Generated by CoffeeScript 1.10.0 (function() { var color, correct_x, correct_y, height, svg, treemap, vis, width, zoom, zoomable_layer; svg = d3.select('svg'); width = svg.node().getBoundingClientRect().width; height = svg.node().getBoundingClientRect().height; treemap = d3.layout.treemap().size([width, height]).value(function(node) { return node.count; }).sort(function(a, b) { if (a.name === 'a' || b.name === 'b') { return +1; } if (a.name === 'b' || b.name === 'a') { return -1; } return a.count - b.count; }).ratio(3).padding(function(node) { if (node.depth === 0) { return [0, 0, 40, 0]; } else if (node.depth === 1) { return 4; } else { return 0; } }).round(false); correct_x = d3.scale.linear().domain([0, width]).range([0, width * 1.05]); correct_y = d3.scale.linear().domain([0, height]).range([0, height * 3 / 4]); color = function(txt, set) { var iset, noise; iset = { 'a': 0, 'intersection': 1, 'b': 2 }[set]; Math.seedrandom(txt + 'abcdef'); noise = function(W) { return Math.random() * W - W / 2; }; return d3.hcl(45 + iset * 90 + noise(90), 40, 50); }; svg.attr({ viewBox: (-width / 2) + " " + (-height / 2) + " " + width + " " + height }); zoomable_layer = svg.append('g'); zoom = d3.behavior.zoom().scaleExtent([1, 10]).on('zoom', function() { return zoomable_layer.attr({ transform: "translate(" + (zoom.translate()) + ")scale(" + (zoom.scale()) + ")" }); }); svg.call(zoom); vis = zoomable_layer.append('g').attr({ transform: "translate(" + (-width / 2) + "," + (-height / 2) + ")" }); d3.csv('english_stopwords_long.txt', function(stopwords_array) { var stopwords; stopwords = {}; stopwords_array.forEach(function(w) { return stopwords[w.word] = true; }); return d3.text('depp.txt', function(infovis_txt) { var data_a, index_a; data_a = nlp.ngram(infovis_txt, { min_count: 1, max_size: 1 })[0].filter(function(w) { return !(w.word in stopwords); }); index_a = {}; data_a.forEach(function(d) { return index_a[d.word] = d; }); return d3.text('elfman.txt', function(hci_txt) { var a, b, data_b, diff_a, diff_b, enter_labels, index_b, intersection, labels, nodes_data, tree; data_b = nlp.ngram(hci_txt, { min_count: 1, max_size: 1 })[0].filter(function(w) { return !(w.word in stopwords); }); index_b = {}; data_b.forEach(function(d) { return index_b[d.word] = d; }); diff_a = data_a.filter(function(a) { return !(a.word in index_b); }); diff_b = data_b.filter(function(b) { return !(b.word in index_a); }); intersection = []; data_a.forEach(function(a) { return data_b.forEach(function(b) { var min; if (a.word === b.word) { min = Math.min(a.count, b.count); intersection.push({ word: a.word, count: min }); if (a.count - min > 0) { diff_a.push({ word: a.word, count: a.count - min }); } if (b.count - min > 0) { return diff_b.push({ word: b.word, count: b.count - min }); } } }); }); a = { children: diff_a.filter(function(d) { return d.count > 1; }), name: "a" }; intersection = { children: intersection.filter(function(d) { return d.count > 1; }), name: "intersection" }; b = { children: diff_b.filter(function(d) { return d.count > 1; }), name: "b" }; tree = { children: [a, intersection, b], name: "root" }; nodes_data = treemap.nodes(tree); labels = vis.selectAll('.label').data(nodes_data.filter(function(node) { return node.depth === 2; })); enter_labels = labels.enter().append('svg').attr({ "class": 'label' }); enter_labels.append('text').text(function(node) { return node.word.toUpperCase(); }).attr({ dy: '0.35em', fill: function(node) { return color(node.word, node.parent.name); } }).each(function(node) { var bbox, bbox_aspect, node_bbox, node_bbox_aspect, rotate; bbox = this.getBBox(); bbox_aspect = bbox.width / bbox.height; node_bbox = { width: node.dx, height: node.dy }; node_bbox_aspect = node_bbox.width / node_bbox.height; rotate = bbox_aspect >= 1 && node_bbox_aspect < 1 || bbox_aspect < 1 && node_bbox_aspect >= 1; node.label_bbox = { x: bbox.x + (bbox.width - correct_x(bbox.width)) / 2, y: bbox.y + (bbox.height - correct_y(bbox.height)) / 2, width: correct_x(bbox.width), height: correct_y(bbox.height) }; if (rotate) { node.label_bbox = { x: node.label_bbox.y, y: node.label_bbox.x, width: node.label_bbox.height, height: node.label_bbox.width }; return d3.select(this).attr('transform', 'rotate(-90)'); } }); enter_labels.attr({ x: function(node) { return node.x; }, y: function(node) { return node.y; }, width: function(node) { return node.dx; }, height: function(node) { return node.dy; }, viewBox: function(node) { return node.label_bbox.x + " " + node.label_bbox.y + " " + node.label_bbox.width + " " + node.label_bbox.height; }, preserveAspectRatio: 'none' }); vis.append('text').text('Johnny Depp').attr({ "class": 'set_label', x: a.x + a.dx / 2, y: height - 22, dy: '0.35em' }); vis.append('text').text('D ∩ E').attr({ "class": 'set_label', x: intersection.x + intersection.dx / 2, y: height - 22, dy: '0.35em' }); return vis.append('text').text('Danny Elfman').attr({ "class": 'set_label', x: b.x + b.dx / 2, y: height - 22, dy: '0.35em' }); }); }); }); }).call(this); LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
nitaku created this gist
Sep 21, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ -