prmr / Creco

Recommendation System for Consumer Products
Apache License 2.0
6 stars 2 forks source link

Add unit comprehension to TypedValue #62

Closed enewe101 closed 10 years ago

enewe101 commented 10 years ago

Currently TypedValue understands numeric values and ranges, with units being stripped off. Capture the units and make them available using getUnits() and hasUnits.

mangalagb commented 10 years ago

Based on the last discussion, Units from TypedValue will not be inferred as it may require project wide changes. Instead, now the issue is about parsing values detected as Strings but which are essentially numeric values. Below, I provide a list of such Strings detected from various categories and the proposed mechanism to convert them into Numeric Types. Please feel free to comment.

1) Claimed battery life STRING: 90 hours will be converted to numeric value 90

2) Width STRING: 14.7" will be converted to numeric value 14.7

3) Dimensions H x W x D (in.) STRING: 4.9 x 4.9 x 4.9 will be converted to a single numeric value - 117.649

4) LCD resolution STRING: 1366 x 768 will be converted to numeric value 1049088

5) I'm not sure about these Strings Size tested STRING: 265/70R17 (car tire) Warranty STRING: 24/84

mangalagb commented 10 years ago

I have parsed and tested cases 1 and 2. I am ignoring cases 3 and 4 since changing them introduces a huge number which causes havoc in other parts of the code like scoredAttributes causing those tests to fail. @asutcl Please tell me if there are any further changes required in TypedValue for the parsing of strings.

prmr commented 10 years ago

In TypedValue.equals, please change the last line so that value.aStringValue == aStringValue becomes value.aStringValue.equals(aStringValue)

prmr commented 10 years ago

@mangalagb what's the status here? Is this issue closeable?

mangalagb commented 10 years ago

I have already made and committed the above mentioned changes into master. So yes. I think this issue can be closed.

prmr commented 10 years ago

I'll add a few tests and improvements to this one.