When President Donald Trump delivers his second State of the Union address on Tuesday, chances are he will promote what he sees as his administration's successes, lay out his agenda for the coming year and try to deliver a positive message.

Why? Because according to a textual analysis of every State of the Union address since Franklin D. Roosevelt’s first one, most annual presidential addresses to Congress are positive affairs. But the degree of positivity can vary based on the state of the economy, whether the country is at war and whether the president’s party is coming off a big midterm loss — like the GOP is under Trump.

We analyzed transcripts of 74 in-person State of the Union addresses since 1934 using a tool called Vader. Created by researchers at Georgia Tech, Vader looks at word choice, punctuation, contractions, negations and other elements to determine the positive, neutral or negative sentiment of a piece of writing.

All but four State of the Union addresses scored positive. Harry Truman's 1950 address is the most positive, while FDR's 1942 address, delivered in the midst of World War II, scores the least positive.

This isn't surprising. The State of the Union gives presidents the chance to sing their own praises and sell Congress and the public on the good work they plan to do next.

It wasn’t always this way. According to presidential historians, the State of the Union began as a report to Congress about the business affairs of the country. Starting with Thomas Jefferson’s presidency, most addresses were delivered as letters to Congress, instead of speeches.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The purpose of the address changed in the 20th century. John Woolley, co-director of the American Presidency Project at the University of California, Santa Barbara, said that President Woodrow Wilson’s 1913 address was the beginning of the president trying to insert himself into the legislative process.

"Woodrow Wilson thought that presidential leadership was essential to making sure that Congress was thinking appropriately about the will of the nation as a whole," Woolley said.

Lyndon Johnson’s 1965 address was the first one in prime time, as well as the first in which the president spoke to the nation as a whole.

Jeffrey Engel, director of the Center for Presidential History at Southern Methodist University, says the point of modern State of the Unions is to sway the country, rather than Congress.

“In a sense, it's no longer a report about the state of the union,” Engel said. “It's really a statement on where the president thinks it should go.”

Given that the purpose of the address is to chart a course for the future, it makes sense that the sentiment of most addresses is positive. But the change in positivity from one address to the next can provide a fascinating snapshot at the mood in Washington at the time.

One thing that can knock down the vibe is when the president’s party loses control of one or both chambers of Congress, as has happened to five presidents besides Trump. (Barack Obama dealt with it twice, in 2011 and 2015.) In four of those cases the sentiment of the address that year was less positive.

The result shows a common phenomenon in presidential politics, Engel said, where presidents try to sound contrite after a midterm loss.

“Most presidents, after getting trounced in the midterms, try to become more moderate,” Engel said. “The traditional move for the president is to say, 'I guess I should listen to the voters.' So they move to the center."

A recession can also damper a president's sentiment. Ten State of the Unions were delivered in the midst of recessions: in 1949, 1954, 1958, 1961, 1970, 1974, 1975, 1980, 1982 and 1991.

Obama gave his 2010 address a few months after the Great Recession officially ended, but the unemployment rate stood at 9.8 percent and the sluggish economy was still a major concern.

Wars can also contribute to somber State of the Unions, like FDR's 1942 address, which came only weeks after Japan attacked Pearl Harbor.

The five least-positive State of the Union addresses since 1934 all came during times of conflict. This includes George W. Bush's addresses in 2002 (months after the 9/11 attacks) and 2003 (months before the start of the Iraq War). FDR’s 1938, 1942 and 1943 addresses were all delivered under the specter of World War II.