Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThimmy Stenlund
7,523 PointsThe "score" doesn't work anymore. How come?
Hey,
Tried both writing the entire exercise myself and using the solution-files through the download. Same gives 0.00% for the "score" on all players. I can see how it is correct incoming sentiment.Score but as soon as it goes to out score, it transform to 0.
Might this be due to new version of Json? (it was 8.X when this video was released and now its 10.x)
Anyone got a clue as to what is doing this?
6 Answers
codeboost
6,886 PointsNot sure if it's the same problem, but I had the issue with double.TryParse not properly parsing the string into a double as well. It seems double.TryParse uses localization to parse the string, and since we use the comma as a decimal separator here (Netherlands, and I think the whole of Europe), TryParse wouldn't parse properly. I fixed this by changing it to the following:
double.TryParse(sentiment.Score, NumberStyles.Any, CultureInfo.GetCultureInfo("en-US"), out score)
Hope this fixes it for you as well.
Simon McGuirk
2,673 PointsI was still having an issue with TryParse today. Took a while but eventually found that when I created the SentimentResponse class and used the Paste as Json option, Score was set to be of type float and instead of string. Changed it to string and error went away.
public string Score { get; set; }
James Churchill
Treehouse TeacherThimmy,
Sorry to hear that you're running into an issue reproducing what's shown in the course. The Text Analytics API has changed since the video was recorded, so that might be contributing to the problem. I'll try to take a look at this soon.
In the meantime, is there any chance that you could share your code with me?
Thanks ~James
David Lin
35,864 PointsHmm ... I just coded it myself, and I get "good" scores for the sentiments.
Sentiment Score: 77.410 %, Date: June 15, 2017 4:52 PM, Headline: There is no av
enging the Red Card Wedding, Summary: The Red Card Wedding game featured regular
starers at four positions, and Oniel Fisher was the only Sounders without a pre
vious MLS start to even appear in the game. Of course, that's also what exposed
them to the season-altering events that eventually ...
Sentiment Score: 92.763 %, Date: June 14, 2017 8:12 PM, Headline: A guide to the
2017 US Open Cup fourth round for New York Red Bulls fans, Summary: Seattle's O
niel Fisher won the 2014 NPSL Championship with New York Red Bulls U-23s, but he
will be in Peru with Jamaica while this game is being played; Portland's roster
includes former RBNY stalwart Roy Miller: both teams, however, have signaled th
eir ...
Sentiment Score: 0.088 %, Date: June 13, 2017 8:00 AM, Headline: Brave Boyz lose
to Peru 1-3 in friendly match, Summary: Showing some offensive enterprise, Jama
ica looked on the verge of picking the lock, with Oneil Fisher, Shamar Nicholson
and Cory Burke driving forward, but Fisher could not finish off as he broke loo
se on Carlos Caceda's goal. Peru's advertised danger man ...
Sentiment Score: 50.000 %, Date: June 7, 2017 1:23 PM, Headline: Four Additional
Sounders FC Players Called into National Team Duty, Summary: Additionally, Onie
l Fisher has been called in by Jamaica and Jordy Delem by Martinique for the Kno
ckout Stage of the 2017 Caribbean Cup. Torres, who has 81 career international c
aps and 12 goals, captains Panama in a pair of FIFA World Cup Qualifiers at ...
Sentiment Score: 94.989 %, Date: June 4, 2017 3:16 PM, Headline: Last Stop: Hous
ton Dynamo at Seattle Sounders, Summary: With Seattle having very good players o
n their left flank, he'll be pushed back more and should stay there to negate th
e abilities of Jones and Oniel Fisher. Seattle played midweek as well, being thu
mped by the Columbus Crew 3 - 0 away from the ...
Sentiment Score: 24.106 %, Date: June 4, 2017 4:11 AM, Headline: Anatomy of a Go
al: Ola's Dagger, Summary: With Delem out of the picture, and with slight pressu
re from Oniel Fisher, Meram has two immediate options: continue dribbling forwar
d toward the middle of the field or slot a pass into Kamara who is running the c
hannel between Seattle's center backs.
Sentiment Score: 50.000 %, Date: June 1, 2017 2:46 AM, Headline: Justin Meram, O
la Kamara each score 8th goal, Crew tops Sounders 3-0, Summary: 4th Official-Fot
is Bazakos. A-12,773 (19,968) LINEUPS: Seattle-Stefan Frei; Tony Alfaro; Osvaldo
Alonso, Jordy Delem, Alvaro Fernandez, Oniel Fisher (Brad Evans, 64th), Joevin
Jones (Roman Torres, 74th), Cristian Roldan, Gustav Svensson; Seyi Adekoya ...
Sentiment Score: 93.718 %, Date: June 7, 2017 8:00 AM, Headline: Provisional 40
Player Rosters Announced for 2017 CONCACAF Gold Cup, Summary: USA); Oniel Fisher
(Seattle Sounders FC , USA); Shaun Francis (San Jose Earthquakes, USA); Fabian
Grant (Harbour View FC, JAM); Rosario Harriott (Harbour View FC, JAM); Kemar Law
rence (New York Red Bulls, USA); Damion Lowe (Minnesota United FC, USA); Alvas .
..
Sentiment Score: 9.066 %, Date: August 17, 2015 6:46 PM, Headline: Versatility h
elps Oniel Fisher break into Sounders' rotation, Summary: Cristian Roldan's firs
t impression of his future Sounders teammate, Oniel Fisher, was both painful and
prescient. The 2013 College Cup quarterfinal matchup between Washington and New
Mexico remains a bit of locker-room trash talk to this day, as Fisher ...
Sentiment Score: 99.544 %, Date: June 16, 2017 7:18 PM, Headline: It's 2018 Time
: Who Might Challenge Gov. Scott?, Summary: "What has been interesting ... is th
e number of people who have wanted to have off-the-record conversations with the
party about the possibility of running," says Conor Casey, executive director o
f the Vermont Democratic Party. "Some pretty big names and ...
Sentiment Score: 96.200 %, Date: June 3, 2017 10:00 PM, Headline: Nine facts and
stats on the Colorado Rapids' legendary #9, Conor Casey, Summary: Conor Casey w
ill be inducted into the club's Gallery of Honor during a pregame ceremony on Sa
turday. With that in mind, here are nine numerical nuggets for the club's most p
rolific number nine. 1. Conor Casey made 119 regular season appearances for the
...
Sentiment Score: 80.159 %, Date: June 12, 2017 3:41 PM, Headline: NISCA Names 2
017 All-American Divers, Summary: You can read the full submission criteria here
. Conor Casey of Woodson High School was the boys national champion, competing o
ut of Fairfax, Virginia. Casey, a grade 11 student, won the 2017 Virginia 6A Sta
te League title after placing 4th in 2016.
Thimmy Stenlund
7,523 Pointsdanielterhorst - Seems to have fixed it! That together with the Repel working really bad for someone with a nordic keyboard setting makes a bit grumpy. Sorry for late reply to everyone, I really appreciate the help. Been away from the location I had the code at until today so it's been difficult to review the replies.
James Churchill
Treehouse Teacherdanielterhorst,
Great job finding the solution and thanks for sharing it with everyone! I've updated the Teacher's Notes for this video to include information about this important workaround.
Thanks ~James
Radu - Adrian Buha
Courses Plus Student 5,535 PointsCan you please add the Simon McGuirk's response, to change the type of the Score property from float to string? It's helpful.