我在2个单独的文本文件中有2个语音数据。我在这个问题的底部附上了演讲数据,因为tm
上的大多数问题都没有提供数据,并且让其他人难以回答他们的问题。我根据这两个文本文件创建了一个语料库。
然后我将转换应用于这些语音数据。除stemCompletion
步骤外,所有工作都完美无缺。
corpus.tmp <- tm_map(corpus, removePunctuation)
# remove whitespace
corpus.tmp <- tm_map(corpus.tmp, stripWhitespace)
# convert to lower case letters
#
#corpus.tmp <- tm_map(corpus.tmp, tolower)
corpus.tmp <- tm_map(corpus.tmp, content_transformer(tolower))
# remove stopwords
corpus.tmp <- tm_map(corpus.tmp, removeWords, c(stopwords("english"), "tweet", "views", "mitt", "romney", "obama", "barack"))
# stemming
corpus.tmp <- tm_map(corpus.tmp, stemDocument, language = "english")
corpus.tmp <- tm_map(corpus.tmp, stemCompletion, dictionary = corpus.tmp)
我遇到了以下错误,但事实并非如此。当我检查语料库时,内容都变成了错误消息。谁能告诉我出了什么问题?如何解决?
Warning message:
In mclapply(content(x), FUN, ...) :
all scheduled cores encountered errors in user code
Browse[1]> inspect(corpus.tmp)
<<VCorpus (documents: 2, metadata (corpus/indexed): 0/0)>>
inspect(corpus.tmp)
[[1]]
[1] "Error in setNames(if (length(n)) n else rep(NA, length(x)), x) : \n 'names' attribute [60] must be the same length as the vector [2]\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in setNames(if (length(n)) n else rep(NA, length(x)), x): 'names' attribute [60] must be the same length as the vector [2]>
[[2]]
[1] "Error in setNames(if (length(n)) n else rep(NA, length(x)), x) : \n 'names' attribute [61] must be the same length as the vector [2]\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in setNames(if (length(n)) n else rep(NA, length(x)), x): 'names' attribute [61] must be the same length as the vector [2]>
2个单独的文本文件如下:
[[1]]
<<PlainTextDocument (metadata: 7)>>
07/29/12 – Mitt Romney’s Policy Speech in Jerusalem
Tweet
Thank you for that kind introduction, Mayor Barkat, and thank you all for that warm welcome. It’s a pleasure and a privilege to be in Israel again.
To step foot into Israel is to step foot into a nation that began with an ancient promise made in this land. The Jewish people persisted through one of the most monstrous crimes in human history, and now this nation has come to take its place among the most impressive democracies on earth. Israel’s achievements are a wonder of the modern world.
These achievements are a tribute to the resilience of the Israeli people. You have managed, against all odds, time and again throughout your history, to persevere, to rise up, and to emerge stronger.
The historian Paul Johnson, writing on the 50th anniversary of the creation of the Jewish state, said that over the course of Israel’s life, 100 completely new independent states had come into existence. “Israel is the only one whose creation can fairly be called a miracle,” Johnson wrote.
It is a deeply moving experience to be in Jerusalem, the capital of Israel.
Our two nations are separated by more than 5,000 miles. But for an American abroad, you can’t get much closer to the ideals and convictions of my own country than you do in Israel. We’re part of the great fellowship of democracies. We speak the same language of freedom and justice, and the right of every person to live in peace. We serve the same cause and provoke the same hatreds in the same enemies of civilization.
It is my firm conviction that the security of Israel is in the vital national security interest of the United States. And ours is an alliance based not only on shared interests but also on enduring shared values.
In those shared values, one of the strongest voices is that of your prime minister, my friend Benjamin Netanyahu. I met with him earlier this morning and I look forward to my family joining his this evening as they observe the close of this fast day of Tisha B’Av.
It’s remarkable to consider how much adversity, over so great a span of time, is recalled by just one day on the calendar. This is a day of remembrance and mourning, but like other such occasions, it also calls forth clarity and resolve.
At this time, we also remember the 11 Israeli athletes and coaches who were massacred at the Munich Olympics forty years ago. Ten years ago this week, 9 Israeli and American students were murdered in the terrorist attack at Hebrew University. And tragedies like these are not reserved to the past. They are a constant reminder of the reality of hate, and the will with which it is executed upon the innocent.
It was Menachem Begin who said this about the Ninth of the month of Av: “We remember that day,” he said, “and now have the responsibility to make sure that never again will our independence be destroyed and never again will the Jew become homeless or defenseless.” “This,” Prime Minister Begin added, “is the crux of the problems facing us in the future.”
So it is today, as Israel faces enemies who deny past crimes against the Jewish people and seek to commit new ones.
When Iran’s leaders deny the Holocaust or speak of wiping this nation off the map, only the naïve – or worse – will dismiss it as an excess of rhetoric. Make no mistake: the ayatollahs in Tehran are testing our moral defenses. They want to know who will object, and who will look the other way.
My message to the people of Israel and the leaders of Iran is one and the same: I will not look away; and neither will my country. As Prime Minister Begin put it, in vivid and haunting words, “if an enemy of [the Jewish] people says he seeks to destroy us, believe him.”
We have seen the horrors of history. We will not stand by. We will not watch them play out again.
It would be foolish not to take Iran’s leaders at their word. They are, after all, the product of a radical theocracy.
Over the years Iran has amassed a bloody and brutal record. It has seized embassies, targeted diplomats, and killed its own people. It supports the ruthless Assad regime in Syria. They have provided weapons that have killed American soldiers in Afghanistan and Iraq. It has plotted to assassinate diplomats on American soil. It is Iran that is the leading state sponsor of terrorism and the most destabilizing nation in the world.
We have a solemn duty and a moral imperative to deny Iran’s leaders the means to follow through on their malevolent intentions.
We should stand with all who would join our effort to prevent a nuclear-armed Iran – and that includes Iranian dissidents. Do not erase from your memory the scenes from three years ago, when that regime brought death to its own people as they rose up. The threat we face does not come from the Iranian people, but from the regime that oppresses them.
Five years ago, at the Herzliya Conference, I stated my view that Iran’s pursuit of nuclear weapons capability presents an intolerable threat to Israel, to America, and to the world.
That threat has only become worse.
Now as then, the regime’s claims that it seeks to enrich nuclear material for peaceful purposes are belied by years of malign deceptions.
Now as then, the conduct of Iran’s leaders gives us no reason to trust them with nuclear material.
But today, the regime in Iran is five years closer to developing nuclear weapons capability. Preventing that outcome must be our highest national security priority.
I want to pause on this last point. It is sometimes said that those who are the most committed to stopping the Iranian regime from securing nuclear weapons are reckless and provocative and inviting war.
The opposite is true. We are the true peacemakers. History teaches with force and clarity that when the world’s most despotic regimes secure the world’s most destructive weapons, peace often gives way to oppression, to violence, or to devastating war.
We must not delude ourselves into thinking that containment is an option. We must lead the effort to prevent Iran from building and possessing nuclear weapons capability. We should employ any and all measures to dissuade the Iranian regime from its nuclear course, and it is our fervent hope that diplomatic and economic measures will do so. In the final analysis, of course, no option should be excluded. We recognize Israel’s right to defend itself, and that it is right for America to stand with you.
These are some of the principles I first outlined five years ago. What was timely then has become urgent today.
Let me turn from Iran to other nations in the Middle East, where we have seen rising tumult and chaos. To the north, Syria is on the brink of a civil war. The dictator in Damascus, no friend to Israel and no friend to America, slaughters his own people as he desperately clings to power.
Your other neighbor to the north, Lebanon, is under the growing and dangerous influence of Hezbollah.
After a year of upheaval and unrest, Egypt now has an Islamist President, chosen in a democratic election. Hopefully, this new government understands that one true measure of democracy is how those elected by the majority respect the rights of those in the minority. The international community must use its considerable influence to ensure that the new government honors the peace agreement with Israel that was signed by the government of Anwar Sadat.
As you know only too well, since Hamas took control of the Gaza Strip in 2007, thousands of rockets have rained on Israeli homes and cities. I have walked on the streets of Sderot, and honor the resolve of its people. And now, new attacks have been launched from the Sinai Peninsula.
With Hezbollah rockets aimed at Israel from the north, and Hamas rockets aimed from the south, with much of the Middle East in tumult, and with Iran bent on nuclear arms, America’s vocal and demonstrated commitment to the defense of Israel is even more critical. Whenever the security of Israel is most in doubt, America’s commitment to Israel must be most secure.
When the decision was before him in 1948, President Harry Truman decided without hesitation that the United States would be the first country to recognize the State of Israel. From that moment to this, we have been the most natural of allies, but our alliance runs deeper than the designs of strategy or the weighing of interests.
The story of how America – a nation still so new to the world by the standards of this ancient region – rose up to become the dear friend of the people of Israel is among the finest and most hopeful in our nation’s history.
Different as our paths have been, we see the same qualities in one another. Israel and America are in many respects reflections of one another.
We both believe in democracy, in the right of every people to select their leaders and choose their nation’s course.
We both believe in the rule of law, knowing that in its absence, willful men may incline to oppress the weak.
We both believe that our rights are universal, granted not by government but by our Creator.
We both believe in free enterprise, because it is the only economic system that has lifted people from poverty, created a large and enduring middle class, and inaugurated incomparable achievements and human flourishing.
As someone who has spent most of his life in business, I am particularly impressed with Israel’s cutting edge technologies and thriving economy. We recognize yours as the “start-up nation” – and the evidence is all around us.
You have embraced economic liberty. You export technology, not tyranny or terrorism. And today, your innovators and entrepreneurs have made the desert bloom and have made for a better world. The citizens of our countries are fortunate to share in the rewards of economic freedom and in the creativity of our entrepreneurs. What you have built here, with your own hands, is a tribute to your people, and a model for others.
Finally, we both believe in freedom of expression, because we are confident in our ideas and in the ability of men and women to think for themselves. We do not fear open debate. If you want to hear some very sharp criticisms of Israel and its policies, you don’t have to cross any borders. All you have to do is walk down the street and into a café, where you’ll hear people reasoning, arguing, and speaking their mind. Or pick up an Israeli newspaper – you’ll find some of the toughest criticism of Israel you’ll read anywhere. Your nation, like ours, is stronger for this energetic exchange of ideas and opinions.
That is the way it is in a free society. There are many millions of people in the Middle East who would cherish the opportunity to do the same. These decent men and women desire nothing more than to live in peace and freedom and to have the opportunity to not only choose their government but to criticize it openly, without fear of repression or repercussion.
I believe that those who oppose these fundamental rights are on the wrong side of history. But history’s march can be ponderous and painfully slow. We have a duty to speed and shape history by being unapologetic ambassadors for the values we share.
The United States and Israel have shown that we can build strong economies and strong militaries. But we must also build strong arguments that advance our values and promote peace. We must work together to change hearts and awaken minds through the power of freedom, free enterprise and human rights.
I believe that the enduring alliance between the State of Israel and the United States of America is more than a strategic alliance: it is a force for good in the world. America’s support of Israel should make every American proud. We should not allow the inevitable complexities of modern geopolitics to obscure fundamental touchstones. No country or organization or individual should ever doubt this basic truth: A free and strong America will always stand with a free and strong Israel.
And standing by Israel does not mean with military and intelligence cooperation alone.
We cannot stand silent as those who seek to undermine Israel, voice their criticisms. And we certainly should not join in that criticism. Diplomatic distance in public between our nations emboldens Israel’s adversaries.
By history and by conviction, our two countries are bound together. No individual, no nation, no world organization, will pry us apart. And as long as we stay together and stand together, there is no threat we cannot overcome and very little that we cannot achieve.
Thank you all. May God bless America, and may He bless and protect the Nation of Israel.
4,889 views
[[2]]
<<PlainTextDocument (metadata: 7)>>
08/14/12 – Mitt Romney’s Speech in Chillicothe, Ohio
Tweet
Thank you, Ohio. It’s good to be back in the Buckeye State. And it’s a privilege to be here with two good friends – your great governor, John Kasich and your outstanding senator, Rob Portman. Governor Kasich is doing a great job despite the head winds from Washington. As President, I can’t wait to work with Senator Portman to turn those Obama headwinds into pro-job policies that will help working families all across Ohio.
Tonight, we’re wrapping up our five-state bus tour to towns big and small. That trip reconfirmed to me just how important this election is – and why we need to change the direction of the country by changing the current occupant of the Oval Office.
We started out on the decks of a battleship in Norfolk, Virginia, where arbitrary and reckless defense cuts threaten our national security and 150,000 jobs. From there it was on to North Carolina, through towns that have lost thousands and thousands of manufacturing jobs. And yesterday we were in Florida, where families are still struggling with the Obama Economy.
The people I met on this tour – and the thousands of Americans I’ve visited in break rooms and lunch rooms, in school gymnasiums and on factory floors – are worried about their children, their jobs, their mortgages, and their future. And they are right to be worried.
All across the country, I’ve met people who are hurting. Some have lost their jobs; others work two jobs just to get by. Some have fallen out of the middle class and now they’re struggling to get back to where they started. The cost of living keeps going up, and they’re living paycheck to paycheck.
They are tired of being tired.
And tonight, I’d like to say to each of them: You have not been forgotten. We will not leave you behind. This is America. We are Americans. It doesn’t have to be this way!
Unemployment has been above 8 percent for 42 straight months. We will put Americans back to work!
Half of recent college graduates can’t find work or a job that matches their skills. We’ll get good jobs for our kids.
Nearly one out of six Americans are in poverty today. This is a disgrace we will end.
And President Obama has amassed five trillion dollars of debt – nearly as much debt held by the public as all other Presidents combined. We will end this moral failure.
After four years, it’s clear that President Obama’s policies aren’t fixing these problems, they’re making them worse. That is why Ohio will lead the way by electing a new President on November 6th.
For the first time, most Americans believe that our best days are behind us. This is an election in which we should be talking about the path ahead, but you don’t hear any answers coming from President Obama’s re-election campaign. That’s because he’s intellectually exhausted, out of ideas, and out of energy. And so his campaign has resorted to diversions and distractions, to demagoguing and defaming others. This is an old game in politics; what’s different this year is that the president is taking things to a new low.
It wasn’t supposed to be this way.
In 2008, Candidate Obama said, “if you don’t have any fresh ideas, then you use stale tactics to scare voters.” He said, “if you don’t have a record to run on, then you paint your opponent as someone people should run from.” And that, he told us, is how, “You make a big election about small things.”
That was Candidate Obama describing the strategy that is the now the heart of his campaign.
His campaign and his surrogates have made wild and reckless accusations that disgrace the office of the Presidency. Another outrageous charge came a few hours ago in Virginia. And the White House sinks a little bit lower.
This is what an angry and desperate Presidency looks like.
President Obama knows better, promised better and America deserves better.
Over the last four years, this President has pushed Republicans and Democrats as far apart as they can go. And now he and his allies are pushing us all even further apart by dividing us into groups. He demonizes some. He panders to others. His campaign strategy is to smash America apart and then cobble together 51 percent of the pieces.
If an American president wins that way, we all lose.
But he won’t win that way. America is one Nation under God. American history has been a story of the many becoming one – uniting to preserve liberty, uniting to build the greatest economy in the world, uniting to save the world from unspeakable darkness. Everywhere I go in America there are monuments that list those who have given their lives. There is no mention of their race, their party affiliation or what they did for a living. They lived and died under a single flag fighting for a single purpose. They pledged allegiance to the United States of America. So, Mr. President, take your campaign of division and anger and hate back to Chicago and let us get about rebuilding and reuniting America.
This election is about restoring the promise of America. It’s a choice between two visions for our nation’s future. It’s about the challenges America faces. It is about a better tomorrow and a better future.
We don’t need more excuses. We don’t need more blame. We don’t need more small-minded attacks.
What we really need is a new president.
Voters deserve an honest debate. And that’s what Paul Ryan and I will give them.
Paul and I have a positive agenda that will lead to economic growth, to widespread and shared prosperity that will improve the lives of our fellow citizens. Our Plan For A Stronger Middle Class will get America back to work and get our country back on track.
We are offering solutions that are bold, specific, and achievable. We’re committed to helping create 12 million new jobs and to bring better take-home pay to middle class families.
My plan focuses on five things.
First, energy independence. We will achieve North America energy independence by 2020, by taking full advantage of our oil, our gas, our coal, our renewables and our nuclear power. Abundant, inexpensive, domestic energy will not only create energy jobs, it will bring back manufacturing jobs.
Second, we must give our workers and our children the skills they need to succeed. Our nation cannot continue to fail in public education. For too long, we have let the agenda of union bosses steer the agenda of our schools. It is time to put our kids and their parents and their teachers first, and the union bosses behind.
Third, trade must work for America. We are one of the world’s most productive nations. Trade creates jobs and raises take-home pay for American workers. We must open more doors for trade in Latin America, where there is a growing middle class. But when any nation cheats, as China has cheated, we must make sure that there are clear and compelling consequences.
Fourth, we will do what politicians in both parties have been promising for years, but have failed to do. We will cut spending, shrink deficits, and put America on track to a balanced budget.
Fifth, we will champion small business. Unlike President Obama, I won’t raise taxes on small business. I’ll make sure regulators protect the public, but that they stop killing our jobs. I will remove the crippling uncertainty that is preventing businesses from hiring.
That begins by repealing Obamacare. It’s bad for jobs and it’s bad for seniors. If the President is re-elected, he will succeed in raiding $716 billion from Medicare — from the trust fund you have paid into all your lives – to pay for Obamacare. He is taking your money to finance his risky and unproven takeover of the health-care system. He is putting Medicare at greater risk. He is putting health care at greater risk. He is putting your jobs at greater risk. We must not let Obamacare happen.
If we focus on these five areas – energy, education, trade, deficits, and championing small business – America’s economy will come roaring back to life. And we will finally see a comeback for America’s middle class.
My plan is based on proven principles that will produce real results. I spent 25 years in business, and I know what it takes for the private sector to create jobs. I know why jobs go away, what it takes to bring them back, and what we must do to make America the best place in the world for entrepreneurs and innovators and job creators. My five-point plan will bring more jobs and more take-home pay for middle-class Americans.
People ask me why I think the President’s policies have been such a disappointment. I just don’t think President Obama understands what it is that drives our economy.
America runs on freedom. Free men and women, pursuing their dreams, working hard to build a better future for their families. This is what propels our economy. When an American succeeds, when she wins a promotion, when he creates a business, it is that individual, that American that has earned it, that has built it. Government does not build our businesses, the American people do.
The American people also build the government. We pay for it with our taxes. We choose who will lead us with our votes.
Do you want a president who believes that your rights come from God, not from government?
Do you want a president who honors your right to pursue happiness, not as government commands, but as you choose?
Do you want a president who will work every day to bring us together, not tear us apart?
Do you want a president who will celebrate success, not attack it?
Do you want a president who will never, ever apologize for the greatest nation on earth?
With your support, I will be that President.
We are 84 days away from the start of the better future we deserve.
We need new leadership, and new ideas, and a new approach – because four years of failure is enough.
Paul Ryan and I believe in America – and in this election, we’re offering Americans a clear and honest choice. Every single day we’re going to do our part. And we need you to do yours.
I commit to you that I will be the President that this moment demands. I will work to strengthen our families, to rebuild our economy and to keep our military second to none in the world.
I ask you to commit like never before over the next 84 days. This election can come down to just one more vote. I ask you find that vote. Ask one more person to join our campaign. Ask one more person to join us who supported President Obama four years ago and didn’t get the change they deserved. One more vote can make the difference in Ohio. And Ohio will make the difference for America.
Thank you. God bless you. And God bless the United States of America.
7,573 views