词云入门
三步曲
- 数据获取:使用爬虫在相关网站上获取文本内容
- 数据清洗:按一定格式对文本数据进行清洗和提取(文本分类,贴标签)
- 数据呈现:多维度呈现和解读数据(计算,做表,画图)
一 模块的安装
pip3 install wordcloud pip3 install matplotlib
二 入门实例
1 准备数据
with open('english-data.txt','r',encoding='utf8')as f:
text=f.read()
Yes Minister is a satirical British sitcom written by Sir Antony Jay and Jonathan Lynn that was first transmitted by BBC Television between 1980 and 1984, split over three seven-episode series. The sequel, Yes, Prime Minister, ran from 1986 to 1988. In total there were 38 episodes, of which all but one lasted half an hour, each episode ending with the title of the series as an answer to any question posed by Hacker. Several episodes were adapted for BBC Radio, and a stage play was produced in 2010, the latter leading to a new television series on UKTV Gold in 2013. Set principally in the private office of a British Cabinet minister in the fictional Department of Administrative Affairs in Whitehall, Yes Minister follows the ministerial career of the Rt Hon Jim Hacker MP, played by Paul Eddington. His various struggles to formulate and enact legislation or effect departmental changes are opposed by the British Civil Service, in particular his Permanent Secretary, Sir Humphrey Appleby, played by Sir Nigel Hawthorne. His Principal Private Secretary Bernard Woolley, played by Derek Fowlds, is usually caught between the two. The sequel, Yes, Prime Minister, continued with the same cast and followed the events of the premiership of Jim Hacker after his unexpected elevation to Number 10 upon the resignation of the previous Prime Minister. The series received a number of awards, including several BAFTAs and in 2004 was voted sixth in the Britain's Best Sitcom poll. It was the favourite television programme of the then Prime Minister of the United Kingdom, Margaret Thatcher.[5] Contents [hide] 1 Situation 2 Character contrast 3 Supporting characters 4 Politics 5 Inspirations 6 Main characters 6.1 Jim Hacker 6.2 Sir Humphrey Appleby 6.3 Bernard Woolley 7 Other recurring characters 8 Episodes 9 Opening titles and music 10 Reception 11 Legacy 12 Stage play 12.1 Claire Sutton 13 2013 television revival 14 Other countries 15 Radio 16 Merchandise 16.1 Home video releases 16.2 Australian/New Zealand releases (Region 4) 16.3 Books 16.4 Video games 17 See also 18 References 19 External links Situation[edit] The series opens in the wake of a general election in which the incumbent government has been defeated by the opposition party, to which Jim Hacker MP belongs. His party affiliation is never stated, and his party emblem is clearly neither Conservative nor Labour. The Prime Minister offers Hacker the position of Minister of Administrative Affairs, which he accepts. Hacker goes to his department and meets his Permanent Secretary, Humphrey Appleby, and his Principal Private Secretary, Bernard Woolley. While Appleby is outwardly deferential towards the new minister, he is prepared to defend the status quo at all costs. Woolley is sympathetic towards Hacker but as Appleby reminds him, Woolley's civil service superiors -- including Appleby -- will have much to say about the course of his future career (i.e. assessments, promotions, pay increases), while ministers do not usually stay long in one department and have no say in civil service staffing recommendations. Many of the episodes revolve around proposals backed by Hacker but frustrated by Appleby, who uses a range of clever stratagems to defeat ministerial proposals while seeming to support them. Other episodes revolve around proposals promoted by Appleby but rejected by Hacker, which Appleby attempts by all means necessary to persuade Hacker to accept. They do occasionally join forces in order to achieve a common goal, such as preventing the closure of their department or dealing with a diplomatic incident. As the series revolves around the inner workings of central government, most of the scenes take place in private locations, such as offices and exclusive members' clubs. Lynn says that "there was not a single scene set in the House of Commons because government does not take place in the House of Commons. Some politics and much theatre takes place there. Government happens in private. As in all public performances, the real work is done in rehearsal, behind closed doors. Then the public and the House are shown what the government wishes them to see."[6] However, the episode "The Compassionate Society" does feature an audio recording of Yesterday in Parliament in which Hacker speaks in the House of Commons, and other episodes include scenes in the Foreign Secretary's House of Commons office ("The Writing on the Wall") and a Committee room ("A Question of Loyalty"). At the time of the making of the series, television cameras were not allowed in the House of Commons and had only recently been introduced into the House of Lords, so it was not unusual to a British audience to have no scenes from there. Character contrast[edit] The different ideals and self-interested motives of the characters are frequently contrasted. Whilst Hacker occasionally approaches an issue from a sense of idealism and a desire to be seen to improve things, he ultimately sees his re-election and elevation to higher office as the key measures of his success. Accordingly, he must appear to the voters to be effective and responsive to the public will. To his party (and, in the first incarnation of the series, the Prime Minister) he must act as a loyal and effective party member. Sir Humphrey, on the other hand, genuinely believes that the Civil Service, being politically impartial, has the most realistic idea of what "good governance" means, and therefore knows what is best for the country — a belief shared by his bureaucratic colleagues. Hacker sees the job of government as one of "doing good",[7] or more specifically reforming the country according to his own party's policies: which, more often than not, means the initiation of departmental reforms and economies, a reduction of the level of bureaucracy and reduction of staff numbers in the Civil Service. To do so, or to at least look as if he is doing so, is what he considers to be a vote-winner. Conversely, Sir Humphrey sees his role as ensuring that politics is kept out of government as much as possible and that the status quo is upheld as a matter of principle. But with the status quo notably including the prestige, power and influence of the Civil Service, Sir Humphrey attempts to block any move that seeks either to prevent the further expansion of the civil service or to reduce the complexity of its bureaucracy. Much of the show's humour thus derives from the antagonism between Cabinet ministers (who believe they are in charge) and the members of the British Civil Service (who believe they really run the country). A typical episode centres on Hacker's suggesting and pursuing a reform and Sir Humphrey's blocking of all Hacker's lines of approach. More often than not, Sir Humphrey prevents him from achieving his goal while mollifying Hacker with some positive publicity, or at least a means to cover up his failure. Occasionally, however, Hacker does get his way, often by thwarting other arrangements or deals that Sir Humphrey has been making behind the scenes elsewhere with other ministers or civil servants — or in the case of the episode "The Tangled Web", Hacker successfully blackmailing Sir Humphrey into taking his stance. Sir Humphrey occasionally resorts to tactics such as calling a policy "courageous" to remind Hacker to contemplate the view that "a controversial policy will lose votes, whilst a courageous one will lose [him] the election", and thus to hinder the implementation of a particular policy. Sir Humphrey, on the other hand, believes that from the Civil Service's perspective "it makes very little difference who the Minister is". Initially, Bernard naively sees his job as the disinterested implementation of the Minister's policies, but he gradually finds that this conflicts with his institutional duty to the department, and sometimes (since Sir Humphrey is responsible for formally assessing Woolley's performance) his own potential career development.[1] Consequently, another recurring scenario is one where Bernard must "walk the tightrope" — that is, balance his two conflicting duties by resorting to elaborate verbosity (much like Sir Humphrey) so that he can avoid the appearance of being disloyal to one, in favour of the other. For example, in "The Skeleton in the Cupboard", he sees the importance of notifying Sir Humphrey that Hacker has left his office, whilst still assisting Hacker in his aims. Such is Bernard's success in performing this balancing act, that after the third series, following Sir Humphrey's promotion to Cabinet Secretary, when Hacker becomes Prime Minister he requests that Bernard continue as his Principal Private Secretary, reasserting the perception that he is a "high flier". Sir Humphrey's personal characteristics include his complicated sentences, his cynical views of government, and his snobbery and superciliousness. Hacker's attributes include occasional indecisiveness, and a tendency to launch into ludicrous Churchillian speeches. Bernard is prone to linguistic pedantry. All characters are able to switch to a completely opposite opinion in seconds when convenient. Supporting characters[edit] The first series featured Frank Weisel, Hacker's political adviser (played by Neil Fitzwiliam in the television series, and later by Bill Nighy in the radio series). The first syllable of his surname is pronounced "Wise", but Sir Humphrey and Bernard persistently call him "Weasel". Weisel does not appear after the first series, following his acceptance of a position on a quango (Quasi-Autonomous Non-Governmental Organisation) tasked with investigating the appointment of other quangos, the government's honours system, and "jobs for the boys".[1] The first series of Yes, Prime Minister introduced Dorothy Wainwright (played by Deborah Norton) as a highly able special political adviser to the Prime Minister. Her experience and insight into many civil service tricks ensure a lasting mutual distrust between her and Sir Humphrey and provide an invaluable second opinion for Hacker.[8] Sir Humphrey frequently annoys Dorothy by addressing her as "dear lady". Hacker's home life is shown occasionally throughout the series. His wife Annie (Diana Hoddinott) is generally supportive, but is sometimes frustrated by the disruptions caused by her husband's political career and is at times somewhat cynical about her husband's politics. In one episode, his sociology student daughter, Lucy (Gerry Cowper), becomes an environmental activist, campaigning against the Department's intention to remove protected status from a wooded area believed to be inhabited by badgers. Sir Humphrey falsely assures her there have not been badgers in the woods for some years. Sir Humphrey often discusses matters with other Permanent Secretaries, who appear similarly sardonic and jaded, and the Cabinet Secretary (whom he eventually succeeds in Yes, Prime Minister), Sir Arnold Robinson (John Nettleton), an archetype of cynicism, haughtiness and conspiratorial expertise. Sir Frank Gordon the Permanent Secretary to the Treasury is a friend and often a rival as they jostle for supremacy within the civil service. The fairly counter-intuitive view of government administration displayed by Sir Humphrey is completely taken for granted by the Civil Service. Almost all the episodes (the exceptions chiefly being the earlier ones of the first series) end with one of the characters (usually Sir Humphrey) saying "Yes, Minister" or "Mais oui, Prime Minister," in "A Diplomatic Incident" which centred on negotiations with the President of France. Each episode of the former was more or less self-contained, but the first two episodes of Yes, Prime Minister had a loose story arc relating to Hacker's attempts to reform the United Kingdom's armed forces, while the second was mostly devoted to concluding storylines and character arcs that had been seen over the course of Yes, Minister. Politics[edit] Lynn joined the Cambridge Union in his first year at the University of Cambridge because he thought that he might like to enter politics. "All of the main debaters there, aged twenty, were the most pompous, self-satisfied, self-important bunch of clowns that I've ever clapped eyes on. They were all behaving as if they were on the government front bench, and twenty years later they all were: Michael Howard; John Selwyn Gummer; Kenneth Clarke. I thought at that point that the only way that I could ever contribute to politics is making fun of the politicians."[8] The series, then, intended to satirise politics and government in general, rather than any specific party. The writers placed Hacker at the centre of the political spectrum, and were careful to identify his party headquarters as "Central House" (a combination of Conservative Central Office and Labour's Transport House). The terms "Labour" and "Conservative" are scrupulously avoided throughout the series, favouring terms such as "the party" or "the Government" and "the opposition".[1] In the first scene of the first episode, "Open Government", Hacker is shown at the declaration of his constituency result wearing a white rosette, with other candidates sporting the red and blue rosettes associated with the two leading British parties. The one exception to this neutrality occurs very briefly in "The National Education Service", when Sir Humphrey explains to Bernard how the policy of comprehensive education is retained through successive governments, using different arguments according to which party is in power. Even there, Humphrey does not reveal which party Jim Hacker represents. Despite this, the overall thrust was towards government reduction rather than expansion. The episode "Jobs for the Boys", for example, rejected corporatism. Throughout the period of Yes Minister and Yes Prime Minister the incumbent government of the United Kingdom was Conservative with the government led by Margaret Thatcher. In a 2004 documentary, Armando Iannucci compared Yes Minister to George Orwell's Nineteen Eighty-Four in how it has influenced the public's view of the state. Although Lynn comments that the word "spin" has "probably entered the political vocabulary since the series,"[6] Iannucci suggests that the show "taught us how to unpick the verbal tricks that politicians think they can get away with in front of the cameras."[8] The series depicted the media-consciousness of politicians, reflecting the public relations training they undergo to help them deal with interviews and reading from autocue effectively. This is particularly evident in the episode "The Ministerial Broadcast", in which Hacker is advised on the effects of his clothes and surroundings. The episode "A Conflict of Interest" humorously lampoons the various political stances of Britain's newspapers through their readers (although this material was not original):[9] Hacker: Don't tell me about the press. I know exactly who reads the papers: the Daily Mirror is read by people who think they run the country; The Guardian is read by people who think they ought to run the country; The Times is read by people who actually do run the country; the Daily Mail is read by the wives of the people who run the country; the Financial Times is read by people who own the country; the Morning Star is read by people who think the country ought to be run by another country; and The Daily Telegraph is read by people who think it is. Sir Humphrey: Prime Minister, what about the people who read The Sun? Bernard: Sun readers don't care who runs the country, as long as she's got big tits. — "A Conflict of Interest" Adam Curtis, in his three-part TV documentary The Trap, criticised the series as "ideological propaganda for a political movement",[10] and claimed that Yes Minister is indicative of a larger movement of criticism of government and bureaucracy, centred upon public choice economics. Jay himself supported this. The fallacy that public choice economics took on was the fallacy that government is working entirely for the benefit of the citizen; and this was reflected by showing that in any [episode] in the programme, in Yes Minister, we showed that almost everything that the government has to decide is a conflict between two lots of private interest – that of the politicians and that of the civil servants trying to advance their own careers and improve their own lives. And that's why public choice economics, which explains why all this was going on, was at the root of almost every episode of Yes Minister and Yes, Prime Minister.[11] Inspirations[edit] The writers were inspired by a variety of sources, including sources inside government, published material and contemporary news stories. The writers also met several leading senior civil servants under the auspices of the Royal Institute of Public Administration, a think-tank for the public service sector, which led to the development of some plot lines. Some situations were conceived as fiction, but were later revealed to have real-life counterparts. The episode "The Compassionate Society" depicts a hospital with five hundred administrative staff but no doctors, nurses or patients. Lynn recalls that "after inventing this absurdity, we discovered there were six such hospitals (or very large empty wings of hospitals) exactly as we had described them in our episode."[6] In a programme screened by the BBC in early 2004, paying tribute to the series, it was revealed that Jay and Lynn had drawn on information provided by two insiders from the governments of Harold Wilson and James Callaghan, namely Marcia Williams and Bernard Donoughue.[12]:98 The published diaries of Richard Crossman also provided inspiration.[6][13] In particular the first of these describe his battles with "the Dame", his Permanent Secretary, the formidable Baroness Sharp, the first woman in Britain to hold the position. The episode entitled "The Moral Dimension", in which Hacker and his staff engage in the scheme of secretly consuming alcohol on a trade mission to the fictional Islamic state of Qumran, was based on a real incident that took place in Pakistan, involving Callaghan and Donoughue, the latter of whom informed Jay and Lynn about the incident.[14] Jay says that "I can't tell you where, I can't tell you when and I can't tell you who was involved; all I can tell you is that we knew that it had actually happened. That's why it was so funny. We couldn't think up things as funny as the real things that had happened."[15] Media historian Andrew Crisell suggests that the show was "enriched by the viewers' suspicion that what they were watching was unhealthily close to real life."[16] Fusing inspiration and invention, Lynn and Jay worked on the story "for anything from three days to two weeks," and only took "four mornings to write all the dialogue. After we wrote the episode, we would show it to some secret sources, always including somebody who was an expert on the subject in question. They would usually give us extra information which, because it was true, was usually funnier than anything we might have thought up."[6] Designers Valerie Warrender and Gloria Clayton were given access to the Cabinet Rooms and the State Drawing Rooms. For security purposes, the arrangements of the rooms were altered, and the views from the windows were never shown, to conceal the layout of the buildings.[17] Main characters[edit] Jim Hacker[edit] Main article: Jim Hacker The three main characters in the Minister's Office of the Department of Administrative Affairs: from left, Sir Humphrey Appleby, Bernard Woolley and Jim Hacker The Rt Hon. The Lord Hacker of Islington, KG, PC, BSc (Paul Eddington) was the editor of a newspaper, Reform, before entering government. He apparently spent a good deal of time in Parliament on the Opposition benches before his party won the general election. In Yes Minister he is the Minister for Administrative Affairs (a fictitious ministry of the British government) and a Cabinet Minister, and in Yes, Prime Minister he becomes the Prime Minister of the United Kingdom. Hacker received his degree from the London School of Economics (graduating with a Third), for which he is often derided by the Oxford-educated Sir Humphrey (who attended the fictitious Baillie College graduating with a First in Classics). His early character is that of a gung-ho, but naïve, politician, bringing sweeping changes to his department. Before long, Hacker begins to notice that Civil Service tactics are preventing his planned changes being put into practice. As he learns, he becomes more sly and cynical, using some of the Civil Service ruses himself. While Sir Humphrey initially held all the aces, Hacker now and again plays a trump card of his own. Throughout Yes Minister Hacker, at his worst, is portrayed as a publicity-seeking bungler who is incapable of making a firm decision. He is prone to make potentially embarrassing blunders, and is a frequent target of criticism from the press and stern lectures from the Chief Whip. However, he is also shown to be relatively politically savvy, and he slowly becomes more aware of Sir Humphrey's real agenda. In Yes, Prime Minister Hacker becomes more statesmanlike. He practises more grandiose speeches, dreams up his "grand design" and hones his diplomatic skills. Nearly all of these efforts land him in trouble. In a Radio Times interview to promote Yes, Prime Minister, Paul Eddington stated, "He's beginning to find his feet as a man of power, and he's begun to confound those who thought they'd be able to manipulate him out of hand."[18] Sir Humphrey Appleby[edit] Main article: Humphrey Appleby Sir Humphrey Appleby, GCB, KBE, MVO, MA (Oxon) (Nigel Hawthorne) serves throughout the series as Permanent Secretary under his Minister, Jim Hacker at the Department of Administrative Affairs. He is appointed Cabinet Secretary just as Hacker's party enters a leadership crisis, and is instrumental in Hacker's elevation to Prime Minister. He is committed to maintaining the status quo for the country in general and for the Civil Service in particular.[8] Sir Humphrey is a master of obfuscation and manipulation, baffling his opponents with long winded technical jargon and circumlocutions, strategically appointing allies to supposedly impartial boards, and setting up interdepartmental committees to smother his Minister's proposals in red tape. "Sir Humphrey's big speeches" MENU0:00 An example of Hawthorne's performance of the "big speeches", from the episode "Man Overboard" Problems playing this file? See media help. However, although presenting an outward appearance of supreme confidence and competence, Sir Humphrey is not immune to making miscalculations or outright blunders. When such blunders occur, he relies on the Civil Service bureaucracy to save him. In Britain's Best Sitcom, Stephen Fry comments that "we love the idea of the coherence and articulacy of Sir Humphrey ... it's one of the things you look forward to in an episode of Yes Minister ... when's the big speech going to happen? And can I see if he's reading it from an idiot board ... he's really learned it, and it's superb."[8] Derek Fowlds posited to a concerned Eddington that these speeches were the reason why Hawthorne won a BAFTA for Best Comedy Performance four times in a row, while Eddington, though nominated, did not win at all.[8] Loquacious and verbose, he frequently uses both his mastery of the English language and his grasp of Latin and Greek grammar both to perplex his political master and to obscure the relevant issues. In a Radio Times interview to promote the second series of Yes, Prime Minister, producer Sydney Lotterby stated that he always tried to give Eddington and Hawthorne extra time to rehearse as their scenes invariably featured lengthy dialogue exchanges.[19] Bernard Woolley[edit] Main article: Bernard Woolley Sir Bernard Woolley, GCB, MA (Oxon) (Derek Fowlds) is Jim Hacker's Principal Private Secretary. His loyalties are often split between his Minister and his Civil Service boss, Sir Humphrey. While he is theoretically responsible to Hacker personally, it is Sir Humphrey who writes his performance reviews and influences his Civil Service career. He usually handles these situations well, and maintains his reputation in the Civil Service as a "high flier" as opposed to a "low flier supported by occasional gusts of wind."[20] Woolley is always quick to point out the physical impossibilities of Sir Humphrey's or Hacker's mixed metaphors, with almost obsessive pedantry. He can occasionally appear rather childlike, by making animal noises and gestures or by acting out how such an analogy cannot work, which sometimes annoys his Minister. Woolley tends to side with Hacker when new policies are announced, because they seem radical or democratic, only for Sir Humphrey to point out the disadvantages to the status quo and the civil service in particular. To sway Bernard, Sir Humphrey uses phrases such as "barbarism" and "the beginning of the end".[21] At times when Sir Humphrey fails to get his way, Woolley can be seen smiling smugly at him over his defeat.[22] In a 2004 retrospective, Armando Iannucci commented that Fowlds had a difficult task because he had to "spend most of his time saying nothing but looking interested in everyone else's total and utter guff" but "his one line frequently had to be the funniest of the lot." Iannucci suggests that Woolley is essential to the structure of the show because both Hacker and Appleby confide in him, "which means we get to find out what they're plotting next."[8] The editor's note to The Complete Yes Prime Minister (supposedly published in 2024 after Hacker's death but actually published by the BBC in 1989), thanks "Sir Bernard Woolley GCB" for his help and confirms that he did indeed make it to the position of Head of the Civil Service.[23] Other recurring characters[edit] The series featured a cast of recurring characters. Frank Weisel (often deprecatingly pronounced weasel), played by Neil Fitzwiliam, was Hacker's crusading, idealistic political adviser in the first series. The less scrupulous Hacker found him rather tiresome after a time, while Sir Humphrey found him positively loathsome from the outset. Hacker eventually sent Weisel on a deliberately lengthy worldwide fact-finding assignment, from which he did not return. It was not until Yes, Prime Minister that another such character appeared regularly: Dorothy Wainwright, special adviser to the Prime Minister, who was played by Deborah Norton. Wainwright was rather more down-to-earth than Weisel, and tended to give more practical advice. She knows all of Humphrey's tricks and is able to give the Prime Minister instant advice how to get past his manipulations, and Humphrey knows it and sees her as a threat, though always refers to her as "Dear Lady". Earlier Prime Ministerial advisers had appeared from time to time in episodes of Yes Minister, including Daniel Moynihan as Daniel Hughes in "The Writing on the Wall" (1980) and Nigel Stock as Sir Mark Spencer in "Bed of Nails" (1982). In the later stage play and 2013 television revival, Hacker's young advisor, Claire Sutton, had a larger role than any of her predecessors. Hacker also had a Press Secretary, Bill Pritchard, played by Antony Carrick. Meanwhile, Sir Humphrey's civil service colleagues were also regularly featured. They included: Sir Arnold Robinson (played by John Nettleton), Cabinet Secretary in Yes Minister and later President of the Campaign for Freedom of Information. The reserved, dignified Sir Arnold is a master manipulator, to whom Sir Humphrey often turns for counsel. Sir Frederick Stewart (played by John Savident), Permanent Secretary of the Foreign and Commonwealth Office, known as "Jumbo" to his friends; Sir Ian Whitchurch (played by John Barron), Permanent Secretary to the Department of Health and Social Security Sir Richard Wharton (played by Donald Pickering), Permanent Secretary to the Foreign and Commonwealth Office. Sir Frank Gordon, who appeared in both series of Yes, Prime Minister as Permanent Secretary to the Treasury (played by Peter Cellier). Sir Humphrey also had an old acquaintance: Sir Desmond Glaze* (played by Richard Vernon), who was Board member, then Chairman, of Bartlett's Bank. Glaze* is an amiably vague "chap" (a word he uses frequently to describe banking colleagues), of impeccable respectability, very little actual financial knowledge, and no fixed opinions on anything. He became Governor of the Bank of England in the Yes, Prime Minister episode "A Conflict of Interest", to avoid, as one possibility, Britain's expulsion from the Commonwealth. Hacker's family: His wife, Annie Hacker (played by Diana Hoddinott), who appeared in several episodes, and His daughter, Lucy (played by Gerry Cowper), who only appeared on-screen in one episode ("The Right to Know") as an environmental campaigner, but who is mentioned intermittently throughout. By the time of Yes, Prime Minister, she is a student at the University of Sussex (which Hacker likens to a kibbutz). At one point (in "Party Games") it is implied that the Hackers may have more than one child. Others: Lady Appleby, Sir Humphrey's wife, is mentioned on occasion and seen only briefly in "Big Brother". Various Chief Whips, usually acting in Yes Minister as a "gatekeeper" to the unseen Prime Minister, the first of whom, Vic Gould, was played by Edward Jewesbury.[24] In "Party Games", a later Chief Whip, played by James Grout and identified simply as "Geoffrey", conspires with Sir Humphrey to ensure that Hacker becomes Prime Minister. In "Man Overboard", an episode of Yes, Prime Minister, Hacker addresses his own Chief Whip (played by Peter Cartwright) only by his job title. The latter is clueless about an alleged Cabinet plot against the Prime Minister because there is none and Hacker is pursuing a false trail laid by Sir Humphrey. Hacker's chauffeur, George (Arthur Cox), appeared in five episodes. He is a character who is always more in touch with current events than the Minister—anything from empty NHS hospitals to Cabinet reshuffles. This often irritates Hacker who, when he asks George where the information came from, is usually told that it is common knowledge among the Whitehall drivers. Tom Sargent (Robert Urquhart), Hacker's predecessor as Minister for Administrative Affairs in the previous government, appeared in the episode "Big Brother". Basil Corbett is a rival politician who, though he is not seen, is central to the plot of "The Devil You Know". Dr Peter Cartwright (played by Ian Lavender) is a civil service under-secretary in the Department for Administrative Affairs whose advice Hacker seeks directly in "The Skeleton in the Cupboard", much to Sir Humphrey's displeasure. Sir Humphrey hints at Cartwright's being moved to another job as a result. Well-known broadcasters who played themselves included Robert McKenzie, Ludovic Kennedy and Sue Lawley. Robert Dougall regularly played a newsreader, which was his own real life profession. Among other newscasters, Nicholas Witchell can be heard reporting on Hacker's visit to a school in "The National Education Service" and Sophie Raworth is seen on television in the 2013 revival. Episodes[edit] Main article: List of Yes Minister and Yes, Prime Minister episodes A total of thirty-eight episodes were made, and all but one are of 30 minutes duration. They were videotaped in front of a studio audience, which was standard BBC practice for situation comedies at the time. The actors did not enjoy filming as they felt that the studio audience placed them under additional pressure. Lynn, however, says that the studio audience on the soundtrack was necessary because laughter is a "communal affair." The laughter also acted as a kind of insurance: Jay observes that politicians would be unable to put pressure on the BBC not to "run this kind of nonsense" if "200–250 people were falling about with laughter."[8] There were occasionally film inserts of location sequences, and some shots of Hacker travelling in his car were achieved by means of chroma key. Each programme usually comprised around six scenes. The pilot was produced in 1979 but not transmitted immediately for fear that it could influence the results of the May 1979 UK General Election.[8] It eventually aired on 25 February 1980. Yes Minister ran for three series, each of seven episodes, between March 1980 and 1982. These were followed by two Christmas specials: one 10-minute sketch as part of an anthology presented by Frank Muir,[25] and then the hour-long "Party Games", in 1984. The latter's events led to Hacker's elevation to Prime Minister, dovetailing into the sequel, Yes, Prime Minister. This ran originally for two series, each of eight episodes, from 1986 to 1988. There was a further six-part series, with a new cast, in 2013. Opening titles and music[edit] Gerald Scarfe's caricature of Paul Eddington as Hacker The opening titles were drawn by artist and cartoonist Gerald Scarfe, who provided distinctive caricatures of Eddington, Hawthorne and Fowlds in their respective roles to represent distortion.[8] He animated them as 'self-drawing' by positioning the camera above his paper, adding parts of lines, and then photographing two frames at a time. The sequence ended with the title of the episode superimposed on a facsimile of an edition of the House of Commons Weekly Information Bulletin. Curiously, the legend Compiled in the Public Information Office of the House of Commons Library was left in the sequence. Scarfe created a second set of graphics for Yes, Prime Minister, including a different title card for each episode. Derek Fowlds wanted to buy an original drawing but was unable to afford it.[8] The series' performance credits typically only featured those of the actors who appeared in the particular episode, not the names of characters. The typeface used in the credits is Plantin, a common typeface used in the British press at the time. The show title is set in bold condensed and the credits are in bold. The theme music was composed by Ronnie Hazlehurst and is largely based on the Westminster Quarters: the chimes of Big Ben. When asked in an interview about its Westminster influence, Hazlehurst replied, "That's all it is. It's the easiest thing I've ever done."[26] Scarfe's and Hazlehurst's work was not used for the first episode, "Open Government". The final version of the titles and music had yet to be agreed, and both differ substantially from those used for subsequent instalments. The opening and closing title caption cards feature drawings of most of the cast, but are less exaggerated than those of Scarfe, while the unaccredited music is a more up-tempo piece for brass band. The Scarfe and Hazlehurst credits were used for some repeat broadcasts of the first episode, but the original pilot credits were retained for the DVD release. Reception[edit] The series gained high audience figures, and 90+ on the audience Appreciation Index.[17] Critics, such as Andrew Davies in the Times Educational Supplement and Armando Iannucci, have noted that the show had high expectations of its audience.[17] Lynn posits that the public are more intelligent than most situation comedies, often patronizingly, give them credit for. Jay believes that the viewers were just as intelligent as the writers, but that there were some things that they needed to know but didn't.[8] Yes Minister won the BAFTA award for Best Comedy Series for 1980, 1981 and 1982, and the "Party Games" special was nominated in the Best Light Entertainment Programme category for 1984. Yes, Prime Minister was short-listed for Best Comedy Series for both 1986 and 1987. Nigel Hawthorne's portrayal of Sir Humphrey Appleby won the BAFTA Award for Best Light Entertainment Performance four times (in 1981, 1982, 1986 and 1987). Eddington was also nominated on all four occasions.[27] Nigel Hawthorne was awarded Best Actor in Light Entertainment Programme at the 1981 Broadcasting Press Guild Awards. Yes Minister came sixth in a 2004 BBC poll to find 'Britain's Best Sitcom'.[28] In a list of the 100 Greatest British Television Programmes drawn up by the British Film Institute in 2000, voted by industry professionals, Yes Minister and Yes, Prime Minister were jointly placed ninth. They were also placed 14th in Channel 4's The Ultimate Sitcom, a poll conducted by people who work in sitcoms.[29] The series have been cited by political scientists for their accurate and sophisticated portrayal of the relationships between civil servants and politicians,[30] and are quoted in some textbooks on British politics.[6] The series was highly rated by critics and politicians. The shows were very popular in government circles. The Guinness Television Encyclopedia suggests that "real politicians ... enjoyed the show's cynical dismissal of Whitehall intrigue and its insights into the machinations of government."[31] Lord Donoughue, an admirer of the series who was head of James Callaghan's policy unit at 10 Downing Street from 1976 to 1979, noticed that, when the Labour Party returned to power in 1997 after 18 years in opposition, a number of junior Ministers took so seriously the relationships with civil servants as depicted by Jay and Lynn that they were unduly wary of senior officials and allowed this suspicion to influence their behaviour.[32] Yes Minister and Yes Prime Minister were the favourite programme of then Prime Minister, Margaret Thatcher. She told The Daily Telegraph that "its clearly-observed portrayal of what goes on in the corridors of power has given me hours of pure joy."[17] Gerald Kaufman described it as "The Rt Hon. Faust MP, constantly beset by the wiles of Sir Mephistopheles."[17] As a supporter of Thatcher, Jay embraced her appreciation, although the more leftist Lynn was concerned.[8] Hawthorne and Eddington performing the sketch with Margaret Thatcher in January 1984. Thatcher performed a short sketch with Eddington and Hawthorne on 20 January 1984 at a ceremony where the writers were presented with an award from Mary Whitehouse's NVLA,[33] an event commemorated on the cover of the satirical magazine Private Eye.[34] Authorship of the sketch is unclear. In Britain's Best Sitcom, Bernard Ingham says that he wrote it; other sources give Thatcher sole credit, while Michael Cockerell says that she wrote it with Ingham's help.[5] Another source gives renegade credit to Charles Powell.[17] The actors, who were both starring in separate West End plays at the time, were not enthusiastic at the idea and asked Lynn to "get them out" of it. The writer, however, was not in a position to help. Hawthorne says he and Eddington resented Thatcher's attempts to "make capital" from their popularity.[15] Ingham says that it "went down a bomb", while Lynn brands it a "dreadful sketch" that was only funny because Thatcher was doing it.[8] Accepting the award from the NVLA, Lynn thanked Thatcher "for taking her rightful place in the field of situation comedy." Everyone, except the Prime Minister, laughed.[15] When Paul Eddington visited Australia during the 1980s, he was treated as a visiting British PM by the then Australian leader, Bob Hawke, who was a fan of the show. At a rally, Hawke said "You don't want to be listening to me; you want to be listening to the real Prime Minister", forcing Eddington to improvise.[35] In an interview to promote the first series of Yes, Prime Minister, Derek Fowlds said that "both political sides believe that it satirises their opponents, and civil servants love it because it depicts them as being more powerful than either. And of course, they love it because it's all so authentic."[18] The series was well received in the United States, running on the A&E Network and repeatedly on public television.[36] Legacy[edit] The show has been remade several times, albeit sometimes unofficially. The title of the Portuguese remake, Sim, Sr. Ministro (from 1996), is a direct translation of the original's title. Ji, Mantriji (2001) was the remake in Hindi (with the BBC's permission) by STAR Plus, Rupert Murdoch's Indian satellite TV channel.[37] Both Sir Humphrey and Jim Hacker are portrayed there by the same actors who dubbed them for the original. Not My Department was a Canadian television sitcom, explicitly modelled on Yes Minister, airing on CBC Television in 1987. The Israeli sitcom Polishook, also modelled on Yes Minister, aired for two seasons on Channel 2's Keshet Broadcasting. A Dutch remake had been made by S&V Fiction for VPRO, lasting 11 episodes, called "Sorry Minister". In the Dutch version, Sir Humphrey is a woman and Bernard is a Moroccan called Mohammed.[38] A computer game version of Yes, Prime Minister was published by Mosaic Publishing in 1987 for the BBC Micro, Commodore 64, Amstrad CPC, ZX Spectrum and IBM PCs. The premise was to survive one week in office as Jim Hacker.[39] In 2005, BBC Four launched The Thick of It, described by director Armando Iannucci as "Yes Minister meets Larry Sanders",[40] and The Daily Telegraph called it "a Yes, Minister for the Labour years."[41] The style shows many identifiable hallmarks of Yes Minister, namely the blundering politician virtually entirely dependent on those whose presentational and political nous greatly eclipse his own limited abilities. In a 2006 poll, British MPs voted Yes Minister as the greatest political comedy of all time.[42][43] Stage play[edit] Jay and Lynn collaborated again to produce a stage play[44] which ran from 13 May to 5 June 2010, at Chichester Festival Theatre. This production revived at the Gielgud Theatre, in London's West End from 17 September 2010 until 15 January 2011. The principal cast was David Haig as Jim Hacker, Henry Goodman as Sir Humphrey, Jonathan Slinger as Bernard Woolley and Emily Joyce as Claire Sutton, Hacker's special policy advisor.[45] This production, while following the spirit and tone of the original series in many respects, was set contemporaneously at Chequers, the Prime Minister's country residence, with BlackBerrys frequently in evidence,[46] and even included a topical reference to a coalition agreement which Sir Humphrey had drafted (the Conservatives and Liberal Democrats having formed a coalition government in Britain in May 2010).[47] The plot was a little more provocative and risqué than most of those seen previously (including a debate about the ethics of procuring a fifteen-year-old as a sexual partner for a visiting dignitary,[48] a proposition which Claire suggested might be spun in the national interest as a "euro-job")[49] and included some stronger expletives (reflecting perhaps their widely reported use among New Labour's hierarchy between 1997 and 2010).[50] There was also a higher element of traditional farce.[51] The play began a tour of the United Kingdom in February 2011, with Simon Williams as Sir Humphrey Appleby,[52] Richard McCabe as Jim Hacker[53] and Charlotte Lucas as Claire Sutton. It returned to the West End in July 2011 for a 10-week run at the Apollo Theatre in Shaftesbury Avenue, with Williams and McCabe reprising their roles. The play then went back on a tour of the United Kingdom before returning to the West End with a revised script. Further rewrites took place before the 2012 UK tour and subsequent Trafalgar Studios run, the crucial change having replaced references from underage to multiple partner sex. Reflecting in 2011 on the sustained topicality of Yes, Minister/Prime Minister, Jonathan Lynn noted that, since the opening of the stage show in Chichester, "all we've added is a couple of jokes about [telephone] hacking and an extra joke about the Greeks [subject at the time to a debt crisis]." He added that the original episodes were written about a year before transmission – "satirical comedy doesn't change" – and that "writing in 1986, we found the same headlines in 1956".[54] Its sequel, Yes, Prime Minister, has been also produced internationally in Singapore and Kuala Lumpur in May 2014 by the British Theatre Playhouse.[55] Claire Sutton[edit] The play features a new character, Claire Sutton, who is introduced by the Prime Minister as head of the policy unit at Number Ten. She is a 21st-century successor to Dorothy Wainwright, but less haughty and seemingly more willing to get her hands dirty. She is described by Jay and Lynn as in her late thirties, attractive and intelligent. She calls Hacker by his first name ("Fiscal mechanics, Jim"), whereas Dorothy addressed him as "Prime Minister". In response to a sarcastic interjection about "starving permanent secretaries", Sir Humphrey patronises her as "dear lady" (as he did "that Wainwright female" in the TV series).[56] Emily Joyce, who played Claire both at Chichester and in London, was forty-one when the play opened.[57] The character was retained in the new TV series that followed the play. 2013 television revival[edit] For list of episodes, see List of Yes Minister and Yes, Prime Minister episodes. In January 2013, a new series of Yes, Prime Minister was launched on the Gold television channel.[58] Jim Hacker is now portrayed as heading a coalition government, while dealing with an economic downturn, his coalition partner having a leadership crisis, and Scottish independence.[3] Like the stage play, on which it was broadly based, it is set at Chequers. Filming took place in September 2012. Both David Haig and Henry Goodman reprised their stage roles as Jim Hacker and Sir Humphrey. Haig's Hacker was rather manic,[59] while Goodman's Sir Humphrey was more aloof and supercilious than Hawthorne's had been. The other main characters were Bernard Woolley (Chris Larkin, reprising his role from The Gielgud Theatre run at London's West End) and Claire Sutton (Zoe Telford), the latter with a more prominent role than Hacker's special advisor in the original series. Critical reaction was largely negative.[60] Jay and Lynn revealed that they had offered the show first to the BBC, but that the corporation had asked for a pilot episode which the writers thought was unnecessary in the light of the earlier series. The revived series ended up being produced by the BBC for Gold.[61] Other countries[edit] Both series were aired in Scandinavia during the 1980s. Both series were also aired in the Czech Republic (ČT2) on Friday nights along with other 'britcoms' A Chinese-language translation of the BBC book version of The Complete Yes Minister was in the autumn of 2012 published (ISBN 9787108041012) in Beijing by a major state-owned publisher. Copies were seen on sale in bookshops in the Chinese capital the following year. Both series aired in the US on some PBS stations during the 80s usually in the Sunday night British Comedy Block and have aired on PBS stations as recently as 2013. In West Germany, all three series of Yes Minister were aired in 1987 (German title Yes Minister), and the first series of Yes Prime Minister in 1988 (German title Yes Premierminister) on national public broadcaster ARD; repeats occurred during the 1990s on some of the public regional channels.[62][63] They were broadcast in bilingual mode, permitting owners of a stereo set to select between German overdub and English original sound. Each episode was shortened by about 5 minutes to allow time for the continuity announcer, as was common practice at the time. The second series of Yes Prime Minister was never aired in Germany, thus no German overdub and no German episode titles exist for it. The German DVD release (dec. 2013) reflects these alterations; it contains the full length episodes, but during the edited portions it throws the German sound back to the English one, and it omits the second series of Yes Prime Minister.[64] The books The Complete Yes Minister and The Complete Yes, Prime Minister were also translated into German as Yes Minister (ISBN 3-442-08636-1) and Yes Premierminister (ISBN 3-442-08892-5) respectively. Ji Mantriji (literally "Yes Minister" in Hindi) is an Indian adaptation of the British satirical sitcom Yes Minister. It was telecast on STAR TV's channel STAR Plus with permission from the BBC.[65] Ji Mantriji features Farooq Sheikh as Surya Prakash Singh, the Minister of Administrative Affairs; and Jayant Kripalani as the department's secretary. The plot lines were the same as those of the original, with suitable changes in the Indian context. Radio[edit] Sixteen episodes of Yes Minister were adapted and re-recorded for broadcast by BBC Radio 4, with the principal cast reprising their roles. Produced by Pete Atkin, they were broadcast across two series, each with eight episodes.[66] The first series aired 18 October to 6 December 1983, with the second originally transmitted 9 October to 27 November 1984.[1] The complete set was released on cassette in February 2000, and on compact disc in October 2002. The series was repeated on the digital radio station BBC Radio 7 in early 2007 and on BBC Radio 4 Extra in November 2013. In 1997, Derek Fowlds reprised the role of Bernard Woolley to read Antony Jay's How To Beat Sir Humphrey: Every Citizen's Guide To Fighting Officialdom. It was broadcast in three daily parts by Radio 4 from 29 September to 1 October 1997[1] and released by BBC Audiobooks on cassette in October 1997. Merchandise[edit] Home video releases[edit] The BBC issued some episodes of Yes Minister, and all of Yes Prime Minister on VHS.[67] They were re-released and repackaged at various points. The complete collection was released by the BBC through Warner Home Video on Region 1 DVD in October 2003. Warner appears to have added RCE region coding to the individual release of the second series of Yes Minister, but there are no similar reported problems on playing the complete collection.[67] The BBC, through 2 Entertain Video, also issued several Region 2 DVDs: Yes Minister: Series One (BBCDVD1047), released 1 October 2001 Yes Minister: Series Two (BBCDVD1120), released 30 September 2002 Yes Minister: Series Three & "Party Games" (BBCDVD1188), released 29 September 2003 The Complete Yes Minister (BBCDVD1462), released 15 November 2004 Yes, Prime Minister: Series One (BBCDVD1365), released 4 October 2004 Yes, Prime Minister: Series Two (BBCDVD1729), released 9 May 2005 The Complete Yes Minister & Yes, Prime Minister, released 16 October 2006 The 2013 relaunched series on GOLD was released on the 25 February 2013[68] Yes, Prime Minister: Series One Netflix streams both series to subscribers (as of August 2011, the series was no longer available to view via streaming). Computer users must use the Netflix player and Windows Media Player 11. All four series are also available for download purchase from iTunes and similar programs. Australian/New Zealand releases (Region 4)[edit] Yes Minister: Series One, released 2 April 2002 Yes Minister: Series Two, released 11 February 2002 Yes Minister: Series Three & "Party Games", released 5 May 2003 The Complete Yes Minister, released 10 July 2004 Yes Prime Minister: Series One, released 12 February 2004 Yes Prime Minister: Series Two, released 7 July 2005 Yes Prime Minister: Series One and Two (Box Set), released 11 March 2005 The Complete Yes Minister & Yes, Prime Minister, released 3 October 2007 Roadshow Entertainment Australia[69] / New Zealand[70] – Search DVD Index Books[edit] Several books have been published surrounding the series. The scripts were edited and transformed into prose, and published by BBC Books in the form of diaries. Scenes that did not involve Hacker took the form of private memos between civil servants, or 'interviews' and written correspondence from other characters. In some instances, the novelizations added extra details, while padding-out some existing details. For example, in the novelization for 'The Official Visit', Sir Humphrey manages to confuse Hacker, by reeling-off a plethora of acronyms—without explaining them, leaving Hacker with nonsense to fathom. The three series of Yes Minister were published as paperbacks in 1981, 1982 and 1983 respectively before being combined into a revised hardback omnibus edition, The Complete Yes Minister: The Diaries of a Cabinet Minister, in 1984. Two volumes of Yes, Prime Minister: The Diaries of the Right Hon. James Hacker were published in 1986 and 1987, before being made available as an omnibus edition in 1988. Both series were published as omnibus paperback editions in 1989: The Complete Yes Minister ISBN 0-563-20665-9 The Complete Yes, Prime Minister ISBN 0-563-20773-6 Cheng Hong translated The Complete Yes Minister into simplified Chinese (遵命大臣:内阁大臣海克尔日记). Her husband Li Keqiang later became the Prime Minister of China.[71] Sir Antony Jay's How to Beat Sir Humphrey: Every Citizen's Guide to Fighting Officialdom (ISBN 0-9528285-1-0) was published in April 1997. It was illustrated by Gerald Scarfe and Shaun Williams. It was read by Derek Fowlds on Radio 4 later that year. The "Yes Minister" Miscellany was released in October 2009. The script of the play, Yes, Prime Minister, was published in paperback by Faber & Faber in 2010 (ISBN 978-0-571-26070-6). Graham McCann's 'A Very Courageous Decision: The Inside Story of Yes Minister,' was published by Aurum Books in October 2014 (ISBN 978-1781311899). Video games[edit] A Yes, Prime Minister video game was released in 1987 for Amstrad CPC, BBC Micro, Commodore 64, DOS and ZX Spectrum. In the game, the player takes on the role of Prime Minister Jim Hacker for one week as he navigates through meetings with Sir Humphrey, Bernard Woolley and other government officials, making decisions about seemingly minor government policies which regardless have an effect on the PM's approval rating by the end of the week.
english-data.txt
2 数据分词
from wordcloud import WordCloud
wordcloud = WordCloud().generate(text)
3 数据呈现
import matplotlib.pyplot as plt
plt.imshow(wordcloud,interpolation='bilinear')
plt.axis("off")
plt.show()
import matplotlib.pyplot as plt
from wordcloud import WordCloud # 读取整个文本
with open('yes-minister.txt','r',encoding='utf8')as f:
text=f.read() # 生成一个词云图像
font=r'C:\Windows\Fonts\STXINGKA.TTF'
wordcloud = WordCloud().generate(text) #数据展示
plt.imshow(wordcloud,interpolation='bilinear')
plt.axis("off")
plt.show()
入门完整代码
三 解决中文不能显示问题
不能显示中文是因为wordcloud模块中不存在中文字体包,我们可以自己导入自己的字体库,让wordcloud具备识别中文的能力!
1 找到自己喜欢的字体库,可以取网上自己找字体库,并加载到此文件夹中
2、在进行数据分词的时候我们可以使用我们选中的字体,进行识别中文
font=r'C:\Windows\Fonts\STZHONGS.TTF'
wordcloud = WordCloud(font_path=font).generate(text)
import matplotlib.pyplot as plt
from wordcloud import WordCloud # 读取整个文本
with open('yes-minister.txt','r',encoding='utf8')as f:
text=f.read() # with open('data1.txt','r',encoding='utf8')as f:
# text=f.read() # 生成一个词云图像
font=r'C:\Windows\Fonts\STZHONGS.TTF'
wordcloud = WordCloud(collocations=False,font_path=font,width=1400, height=1400, margin=2).generate(text) # 数据显示
plt.imshow(wordcloud,interpolation='bilinear')
plt.axis("off")
plt.show()
显示中文的完整代码
四 使用背景图片
1 图片
二 读取图片代码
from PIL import Image
import numpy as np football=np.array(Image.open('红心.jpg'))
print(football)
三 完整代码和效果展示
from wordcloud import WordCloud
import matplotlib.pyplot as plt from PIL import Image
import numpy as np # 数据准备
with open('data1.txt','r',encoding='utf8') as f:
text=f.read() # 图片读取
football=np.array(Image.open('红心.jpg'))
print(football) # 数据清洗(分词)
font=r'C:\Windows\Fonts\STZHONGS.TTF'
wordcloud = WordCloud(max_font_size=30,font_path=font,mask=football).generate(text) # 数据显示
plt.imshow(wordcloud,interpolation='bilinear')
plt.axis('off')
plt.show()
设置背景图片完整代码
四 自定义画板
1 基本语法格式
font=r'C:\Windows\Fonts\STZHONGS.TTF'
wc=WordCloud(
background_color='white',
max_words=200,
font_path=font,
min_font_size=15,
max_font_size=50,
width=400,
)
2 参数介绍
ont_path : string 使用的字体库 width : int (default=400) 图片宽度 height : int (default=200) 图片高度 mask : nd-array or None (default=None) 图片背景参考形状 scale : float (default=1) 图幅放大、缩小系数 min_font_size : int (default=4) 最小的字符 min_font_size : int (default=4) 最大的字符 max_words : number (default=200) 最多显示的词数 stopwords : set of strings or None 不需要显示的词 background_color : color value (default="black") 背景颜色
3 简单的设置效果
from wordcloud import WordCloud
import matplotlib.pyplot as plt
# 自定义画板
with open('yes-minister.txt', 'r', encoding='utf8')as f:
text = f.read() font=r'C:\Windows\Fonts\STZHONGS.TTF'
wc=WordCloud(
background_color='white',
max_words=200,
font_path=font,
min_font_size=15,
max_font_size=50,
width=400,
) wc.generate(text)
wc.to_file('自定义图片.png') plt.imshow(wc,interpolation='bilinear')
plt.axis('off')
plt.show()
自定义参数完整代码
实例代码
from wordcloud import WordCloud,ImageColorGenerator
import matplotlib.pyplot as plt from PIL import Image
import numpy as np #数据获取
with open('李小璐xxx.txt','r',encoding='utf8')as f:
text=f.read() # 图片数据获取
cloud_img=np.array(Image.open('关羽.jpg')) # 忽略一些词,例如 st = set(['我们','还是']) #配置wordcloud
font=r'C:\Windows\Fonts\STZHONGS.TTF'
wc = WordCloud(
background_color="white",
mask=cloud_img,
max_words=200,
font_path=font,
min_font_size=0.001,
max_font_size=18,
width=400,
stopwords=st,
)
wc.generate(text)
wc.to_file("ccc.png") #图片保存到ccc.png plt.imshow(wc,interpolation='bilinear')
plt.axis('off')
plt.show()
关羽背景图的词云代码
关羽.jpg
代码显示结果
本文推荐
https://blog.****.net/weixin_37986926/article/details/79004761