コード例 #1
0
ファイル: app.py プロジェクト: brandonwatts/Capstone
    def get(self):
        args = parser.parse_args()
        request = args['request']
        request_type = args['request_type']

        results = nlp.parse(request)

        if request_type == "General":
            return general.call(results)
        elif request_type == "Apartments":
            return apartments.call(results)
コード例 #2
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testHasGym(self):
     api = parse("Show me all buildings in Richmond, Virginia that have a local gym")
     has_fitness_center = api.get('has_fitness_center')
     self.assertTrue(has_fitness_center)
コード例 #3
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def test_max_sqft_1(self):
     api = parse("Show me all apartments that are under 60,000 sqft")
     max_sqft = api.get("max_sqft")
     self.assertEqual(max_sqft, '60000')
コード例 #4
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testStateFullName(self):
     api = parse("Show me all the apartments in Richmond, Virginia.")
     self.assertEqual(api['state'], "Virginia")
コード例 #5
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def test_min_sqft_4(self):
     api = parse("Show all apartments that are greater than 2,000 sqft in Richmond")
     self.assertEqual(api['min_sqft'], '2000')
コード例 #6
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testZipCodeNoState(self):
     api = parse("List apartments in the 23269 area")
     self.assertEqual(api['zip_code'], '23269')
コード例 #7
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testZipCodeAfterState(self):
     api = parse("Show me everything in Richmond, Virginia 23221.")
     self.assertEqual(api['zip_code'], '23221')
コード例 #8
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testHasLaundryFacilitiesIndirectlyStated_2(self):
     api = parse("Show me all apartments in Richmond, Virginia that have a washer and dryer")
     has_laundry_facilities = api.get('has_laundry_facilities')
     self.assertEqual(has_laundry_facilities, True)
コード例 #9
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testDoesNotHaveAirConditioning(self):
     api = parse("Show me all buildings in Richmond, Virginia that does not have air conditioning")
     has_air_conditioning = api.get("has_air_conditioning")
     self.assertFalse(has_air_conditioning)
コード例 #10
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testHasAirConditioning(self):
     api = parse("Show me all buildings in Richmond, Virginia that have air conditioning")
     has_air_conditioning = api.get("has_air_conditioning")
     self.assertTrue(has_air_conditioning)
コード例 #11
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testDishWasherIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that have a dish cleaner")
     has_dishwasher = api.get('has_dishwasher')
     self.assertTrue(has_dishwasher)
コード例 #12
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testDoesNotHaveDishwasher(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have a dishwasher")
     has_dishwasher = api.get('has_dishwasher')
     self.assertFalse(has_dishwasher)
コード例 #13
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testHasDishwasher(self):
     api = parse("Show me all buildings in Richmond, Virginia that have a dishwasher")
     has_dishwasher = api.get('has_dishwasher')
     self.assertTrue(has_dishwasher)
コード例 #14
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def test_has_wheelchair_access_3(self):
     api = parse("Show me all buildings in Richmond, Virginia that have handicap access")
     has_wheelchair_access = api.get('has_wheelchair_access')
     self.assertTrue(has_wheelchair_access)
コード例 #15
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testDoesNotHaveWheelChairAccess(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have wheelchair access")
     has_wheelchair_access = api.get('has_wheelchair_access')
     self.assertFalse(has_wheelchair_access)
コード例 #16
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testCityNotInCityList(self):
     api = parse("Show me all the 3 bedrooms in New York City, New York")
     with self.assertRaises(KeyError):
         city = api["city"]
コード例 #17
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testDoesNotHaveLaundryFacilities(self):
     api = parse("Show me all apartments in Richmond, Virginia that do not have laundry facilities")
     has_laundry_facilities = api.get('has_laundry_facilities')
     self.assertEqual(has_laundry_facilities, False)
コード例 #18
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testStateAbbreviation(self):
     api = parse("What rental property is in Charleston, SC.")
     self.assertEqual(api["city"], "Charleston")
コード例 #19
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testSameCityAsState(self):
     api = parse("Show me all the 3 bedrooms in New York, New York")
     self.assertEqual(api["city"], "New York")
コード例 #20
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testAirConditioningIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that have heating and cooling")
     has_air_conditioning = api.get("has_air_conditioning")
     self.assertTrue(has_air_conditioning)
コード例 #21
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testZipCodeByItself(self):
     api = parse("List houses in the 23269 area code of Richmond.")
     self.assertEqual(api['zip_code'], '23269')
コード例 #22
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testHasParking(self):
     api = parse("Show me all buildings in Richmond, Virginia that have parking")
     has_parking = api.get("has_parking")
     self.assertTrue(has_parking)
コード例 #23
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def test_min_sqft_1(self):
     api = parse("Show all 2,000 feet apartments")
     self.assertEqual(api['min_sqft'], '2000')
コード例 #24
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testDoesNotHaveParking(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have parking")
     has_parking = api.get("has_parking")
     self.assertFalse(has_parking)
コード例 #25
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def test_min_sqft_7(self):
     api = parse("List apartments with at greater than 1,000 ft")
     self.assertEqual(api['min_sqft'], '1000')
コード例 #26
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testHasParkingIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that have a parking garage")
     has_parking = api.get("has_parking")
     self.assertTrue(has_parking)
コード例 #27
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def test_min_sqft_8(self):
     api = parse("Show me all apartments that are at least 50,000 sqft and under 60,000 sqft")
     self.assertEqual(api['min_sqft'], '50000')
コード例 #28
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testIsNotFurnished(self):
     api = parse("Show me all buildings in Richmond, Virginia that are not furnished")
     is_furnished = api.get("is_furnished")
     self.assertFalse(is_furnished)
コード例 #29
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testIsFurnishedIndirectlyStated(self):
     api = parse("Show me all apartments in Richmond, Virginia that already have furniture")
     is_furnished = api.get("is_furnished")
     self.assertTrue(is_furnished)
コード例 #30
0
ファイル: unit.py プロジェクト: brandonwatts/Capstone
 def testDoesNotHaveFitnessCenter(self):
     api = parse("Show me all buildings in Richmond, Virginia that do not have a fitness center nearby")
     has_fitness_center = api.get('has_fitness_center')
     self.assertFalse(has_fitness_center)