The happiest city is Napa, Calif., at least according to an analysis of tweets on Twitter.

In a new study, University of Vermont mathematician Lewis Mitchell and his colleagues created a tool called the "hedonmeter," which collected 10 million tweets that had location data attached from 373 urban areas in the United States — nearly 10 percent of all of Twitter's 2011 posts with location data. They then broke them into individual words.

To figure out which words were happy, sad or neutral, the team used ratings that came from 10,000 users of a website called Mechanical Turk, who assessed 5,000 common words. Curse words and words like "hate" or "wrong" tended to be rated as sad words, while words such as "lol," "sleep" and "funny" were rated as happy. Here's what they found ...

The 15 Happiest Cities in the United States:

Napa, Calif.
Longmont, Colo.
San Clemente, Calif.
Santa Fe, N.M.
Santa Cruz, Calif.
Green Bay, Wis.
Santa Rosa, Calif.
Simi Valley, Calif.
Lafayette, Colo.
Asheville, N.C.
Spokane, Wash.
Boulder, Colo.
Fort Collins, Colo.
Santa Barbara, Calif.
San Jose, Calif.
 
The 15 Saddest Cities in the United States:
 
Beaumont, Texas
Albany, Ga.
Texas City, Texas
Shreveport, La.
Monroe, La.
Memphis, Tenn.
Battle Creek, Mich.
Flint, Mich.
Lima, Ohio
Houma, La.
Waterbury, Conn.
Alexandria, La.
Port Arthur, Texas
Montgomery, Ala.
Dothan, Ala.
 
The Happiest States:
1. Hawaii
2. Maine
3. Nevada
4. Utah 
5. Vermont
6. Colorado
7. Idaho
8. New Hampshire
9. Washington
10. Wyoming
11. Minnesota
12. Arizona
13. California
14. Florida
15. New York 
16. New Mexico 
17. Iowa
18. Oregon
19. North Dakota
20. Nebraska
21. Wisconsin
22. Kansas
23. Alaska
24. Oklahoma
25. Massachusetts 
26. Montana 
27. Missouri 
28. Kentucky 
29. New Jersey
30. West Virginia
31. Illinois 
32. Rhode Island 
33. Indiana 
34. Texas
35. South Dakota 
36. Virginia
37. Tennessee
38. Connecticut
39. Pennsylvania
40. South Carolina
41. North Carolina
42. Ohio
43. Arkansas
44. District of Columbia
45. Michigan 
46. Alabama
47. Georgia 
48. Delaware
49. Maryland
50. Mississippi
51 Louisiana
 
For the full story, read Tweets Reveal Happiest US Cities.
 
Follow LiveScience on Twitter @livescience. We're also on Facebook & Google+