Типичным рабочим процессом является использование annotate() с подходящими конвейерами аннотаторов для получения аннотаций, а затем использование AnnotatedPlainTextDocument() для их объединения с аннотируемым текстом. Это дает объект, наследуемый от «AnnotatedPlainTextDocument» и «TextDocument», из которого можно получить текст и аннотации, используя соответственно as.character() и annotation(). Существуют методы для класса AnnotatedPlainTextDocument и общие слова(), sents(), paras(), tagged_words(), tagged_sents(), tagged_paras(), chunked_sents(), parsed_sents() и parsed_paras(), предоставляющие структурированные представления текст в таких документах. Все это требует, чтобы необходимые аннотации были доступны в используемом объекте аннотации. Методы универсальных шаблонов tagged_words(), tagged_sents() и tagged_paras() предоставляют механизм для сопоставления тегов POS с помощью аргумента карты, см. раздел «Подробности» на странице справки для tagged_words() для получения дополнительной информации. Используемый набор тегов POS будет выводиться из элемента метаданных POS_tagset используемого объекта аннотации.

Анализ настроений

Анализ настроений с помощью обработки естественного языка (NPL)

Набор данных, используемый для анализа настроений, представляет собой набор данных из набора данных UCI (отель). Этот проект основан на предсказании слова на основе модели, которую я обучил в движке Monkeylearn. Следующие результаты отображаются ниже

Набор данных отеля

library(readr)
hotel <- read.csv('hotels (1).csv')
hotel
##                                                                                                                                                                                                     Text
## 1                                                                                                              Very unfriendly staff at reception: not responding to needs and giving wrong information.
## 2                                                                                                                                                         The staff are polite, chatty and very helpful.
## 3                                                                                                                             Although clean and the bed comfy, the room was a little on the small side.
## 4                                                                                                                                                                      And best of all was the location!
## 5                                                                                                                                                                  Wi-Fi sporadic, very slow connection.
## 6                                                                                                                                                     Carpets in the hall and rug in the room was dirty.
## 7                                 Within walking distance of the Empire State Building, Times Square, Central Park and grand central was just around the corner if you prefer to take a train or subway.
## 8                                                                                                                                                 The rooms are extremely small, practically only a bed.
## 9                                                                                     Good placed in the city, very close to Times Square and Rockefeller center, good restaurants and bars close to it.
## 10                                                                                                                                                                            Mattress very comfortable.
## 11                                                                                                                                                                                 No breakfast offered.
## 12                                                                                                                                                                               It was very convenient.
## 13                                                                                                                                                                                 Staff were miserable.
## 14                                                                                                                                                                                   No bathroom in room
## 15                                                                                                                                           The entire bed smelled gross and had really cheap blankets.
## 16                                                                                                                                                 Restaurant staff are much better than the hotel ones.
## 17                                                                                                                                                                              The bed was soooo comfy.
## 18                                                                                                              Front desk stuff was not really friendly and apparently she didn't like her work at all.
## 19                                                                                                                                             Beds are comfortable and air conditioning is working well
## 20                                                                                                                                                                            Very close to Times Square
## 21                                                                                                                                                     Very well located, modern, large and clean rooms.
## 22                                                                                                                                                                           The staff was unbelievable.
## 23                                                                                                                                               Area can be dangerous even close to the metro statıon.
## 24                                                                                                                     The High Line is close-by, and there are lots of great shops and restaurants too.
## 25                                                                                                                                                 someone must have been smoking in the room next door.
## 26                                                                                                                                       Unclean, elevator is slow, have to share a bathroom with others
## 27                                                                                                                                               Buffet breakfast very good, kept us going until evening
## 28                                                                                                                                                      Very spacious rooms, quiet and very comfortable.
## 29                                                                                                                                         For 3 people in a bedroom the sofa bed is a bit uncomfortable
## 30                                                                                                                                                               Lights in the common room were too dim.
## 31                                                                                              1. staff at the front desk were not friendly. 2, food (room service) was horrific and not edible at all.
## 32                                                                                                                                                                        Air conditioning working fine.
## 33                                                                                                                                                         I stayed 5 more days with the same bad smell.
## 34                                                                                                                                                                     Super friendly and helpful staff.
## 35                                                                                                                                                                                Location is excellent.
## 36                                                                                                                   For the relatively fit, it is also walking distance to Times Square/5th Avenue etc.
## 37                                                                                                                                     terrible mattress, wires all over smells industrial elevator  etc
## 38                                                                                                                                                         Bad attitude like he didn't want to be there.
## 39                                                                                                                    location, nice quiet comfortable room, great wifi, excellent free buffet breakfast
## 40                                                                                                                                                           Missed having a fridge or breakfast on site
## 41                                                                                                                                Location is brilliant - a block and a half from Grand Central Station.
## 42                                                                                                                       About a 5 block walk from Grand Central where you can access many subway lines.
## 43                                                                                                                           Room is exactly what I expected, bathroom was nicely modern and very clean!
## 44                                                                                                                                                               Very close to the subway, easy to find.
## 45                                                                                                                                              Terrible, small cubbyholes, which are marketed as rooms.
## 46                                                                                                                                              Our room was facing the back of another office building.
## 47                                                                                                                                                             Great price for a solo business traveler.
## 48                                                                                                                                                    Everyone at this hotel was wonderful to work with.
## 49                                                                                                                                                                      The gym was very small and basic
## 50                                                                                                                                   We had the most iconic view of the Manhattan skyline in every room.
## 51                                                                                                                                                  The mattresses were too "springy" and uncomfortable.
## 52                                                                                                                                              Some thinks didnâ\200\231t work well : air, tv , open windows,
## 53                                                                                                                                             Made it really easy to get anywhere withing a short time.
## 54                                                                                                                                                                                     We were upgraded.
## 55                                                                                                                                                                       Staff if very nice at the desk.
## 56                                                                                                                                                                                         Helpful staff
## 57                                                                                                                                                                    Room wasn't cleaned or bed made up
## 58                                                                                                                                   Clean rooms, genial desk service, very personal experience overall.
## 59                                                                                                      The room was too small for a price tag of $280 + there wasnâ\200\231t even a complimentary water given
## 60                                                                                                                                                                                Close to Times Square.
## 61                                                                                                                                                It is near two subway stations: Grand St and Bowery St
## 62                                                                                                                                The location is amazing - right in the heart of the Flatiron District.
## 63                                                                                                                                                          There were not vending machines that worked.
## 64                                                                                    The heat in the room fluctuated -- at times it felt a little draft, and on my last night, the fan was really loud.
## 65                                                                                                   The position of the hotel is perfect - 20mt  from the Subway (C,E) and one block from the red line.
## 66                                                                                                                                                                    The building was under renovation,
## 67                                                                                                                                                           Perfect breakfast, great start for the day.
## 68                                                                This hotel suits more for business trips rather than for tourists, because Downtown is too far from the most attractions of Manhattan.
## 69                                                                                                                                                                      Room too small to open suitcase.
## 70                                                                                                                Almost everything - price reasonable for location, perfectly located - terrific staff.
## 71                                                                                                                                                      no elevator might be a challenge for some people
## 72                                                                                                                                                                                Got bitten by bedbugs.
## 73                                                                                                                                               We received a $100 a night discount when we complained.
## 74                                                                                                                                                 I had to ask for it and got just 60 dollars discount.
## 75                                                                                                                                                 The location was excellent and the price was amazing.
## 76                                                                                                                                             Well located, friendly staff, comfortable bed, good wifi.
## 77                                                                                                             Friendly staff. Relatively clean (a little bit of dust on the small  coffer). Fair price.
## 78                                                                                                                                                                               The TV was not working.
## 79                                                                                                                                                         Hallways to room stale and didn't feel clean.
## 80                                                                                                                                                      Overall restaurant experience was disappointing.
## 81                                                                                                                                                                          staff will bring luggage up.
## 82                                                                                              They seem to have a gender bias as i only see men working at the reception every time i visit the hotel!
## 83                                                         We thought that it might be best if there was a separate lift for the staff and cleaning service to use, however, this wasnâ\200\231t a huge issue.
## 84                                                                                                                            Hot water was abundant and the A/C (window unit) was ice cold - Excellent!
## 85                                                                                                                                                                 Breakfast was delicious each morning!
## 86                                                                                                                                                 Bar has a great atmosphere and serves delicious food.
## 87                                                                                                                                                             Internet should be free--really not good.
## 88                                                                                                                                                              I was also overcharged for dry cleaning.
## 89                                                                                                                      given this is New York and it is reasonably priced, I think that is fair enough!
## 90                                                                                                           There's also a subway station right outside the hotel and plenty of places to eat and shop.
## 91                                                                                                                                               Anything we needed was just there or a phone call away.
## 92                                                                                                                     Cosmo was made the right way at all other restaurants and lounges during our stay
## 93                                                                                                                                                      we liked very much the location, also the staff.
## 94                                                                                                                                                            Location & price - unbeatable in Manhattan
## 95                                                                                                                                                             Barely room for anything else than sleep.
## 96                                                                                                                     Staffs was very friendly. Room was very clean and the towels were like brand new.
## 97                                                                                                                                                            Lift was a bit of a pain with card access.
## 98                                                                                                                Free wi-fi was spotty and most of the time it was down with no explanation from staff.
## 99                                                                                                                                                      The staff were amazing, so friendly and helpful.
## 100                                                                                                                                                            Friendly staff, good location and clean!!
## 101                                                                                                                                                            A very good hotel - good value for money.
## 102                                                                                                                                                 We had to go to the elevator to get a proper signal.
## 103                                                                                                                            The location was amazing and the room was big enough for the three of us.
## 104                                                                                                                                                                 Lack of complimentary tea or coffee.
## 105                                                                                                                                                                           Wifi access was excellent.
## 106                                                                                                                                                                  The staff was friendly and helpful.
## 107                                                                                                                                                                  not good terms for value for money.
## 108                                                                                                                                                                                  Reliable free wifi.
## 109                                                                                                                                                       Staff could benefit from service with a smile.
## 110                                                                                                                                           But, that breakfast, while good, was obscenely overpriced.
## 111                                                                                                                                                                                The price reasonable.
## 112                                                                                                                                                                         The restaurant is very good.
## 113                                                                                                                                                                                  not real breakfast.
## 114                                                                                                                               Lobby is super load and i had a cockroach encounter in my room, gross.
## 115                                                                                                                                                                                          Nice staff.
## 116                                                                                                                                           The top of the window was then covered by the dirty blind.
## 117                                                                                                         Hotel self service laundry. More space than many NY hotels. Very clean. Very friendly staff.
## 118                                                                                                                                                                    Honestly, the room is overpriced.
## 119                                                                                                     Location was superb, excellent little items like complementary wine/cheese & breakfast was good.
## 120                                                                                                                                          this was expected, clean towels and room cleaned every day.
## 121                                                                                                                                                                              Location, price, stuff.
## 122                                                                                                                                          Although rooms are not big, they are clean and comfortable.
## 123                                                                                                                                                                        hey you get what you pay for.
## 124                                                                                                                                                                     The helpful and efficient staff.
## 125                                         no any view ( a wall ), noisy, air conditioned noisy, internet connection access very poor, the concierge is not there always, breakfast included very poor.
## 126                                                                                            Stays in NY are expensive so as long as you do not have high expectations then this  one is an ok choice.
## 127                                                                                                                                                          Cafeteria was great and they make good food
## 128                                                                                                                                                         We enjoyed drinks on the patio of the hotel.
## 129                                                                                                                     cleanliness, the amenities in the bathroom with make-up mirror, tile and marble.
## 130                                                                                                                                                                                     Very nice people
## 131                                                                                                                                                                               The bathroom is dirty.
## 132                                                                                                                                                                       Great restaurant in the hotel.
## 133                                                                                                                                    The guy at the reception was the unfriendliest receptionist ever.
## 134                                                                                                                                    I enjoyed it because it was clean, quiet, and staff was friendly.
## 135                                                                                                                                                     Comfortable hotel with good restaurant attached.
## 136                                                                                                                                                                                     Wifi was a plus.
## 137                                                                                                                                           This hotel was perfect for my needs; good value for money.
## 138                                                                                                                                        Great value, professional staff and excellent accommodations!
## 139                                                                                                              Bathroom not cleaned, No lift, No heater, Not enough bathrooms or toilets on each floor
## 140                                                                                                 The price was right, we only needed a bed to sleep. Bathroom and showers were clean, room was clean.
## 141                                                                                                                                                                                The breakfast was ok.
## 142                                                                                                                    I had no money my entire trip because i spent 1200 total on my room for 5 nights.
## 143                                                                                                                             However the restaurant downstairs served good food at reasonable prices.
## 144                                                                                                                                                           The room was clean and the staff friendly.
## 145                                                                                                                                                                           Everything was very clean.
## 146                                                                                                                                                    Windows haven't been cleaned for years (if ever).
## 147                                                                                                                                                                           it wasn't even that cheap!
## 148                                                                                                                                                                    Internet connection was very bad.
## 149                                                                         On a positive note it was clean, there was always hot water and elevators so you don' t have to haul your luggage up stairs.
## 150                                                                                                              Larissa at reception was friendly and professional, our room on the 27th floor was good
## 151                                                                                                                     excellent hotel, clean, very friendly and courteous staff, very comfortable beds
## 152                                                                                                                                           Had to call several times for more "complimentary" coffee!
## 153                                                                                                                                                                       the carpet is old and stained.
## 154                                                                                                                                                 Convenient restaurant/bar and continental breakfast.
## 155                                                                                                                                                            Staff very nice, room clean, comfortable.
## 156                                                                                                                                                                     Spacious. Helpful friendly staff
## 157                                                                                                                                                                    Great staff, location, breakfast.
## 158                                                                                                                                        Great location, very quite, and helpful, accommodating staff.
## 159                                                                                                                                                 This is a great location clean hotel and good staff.
## 160                                                                                                                                                                  Friendliness of the staff, location
## 161                                                                                                      Location, too far from attractions. Hotel food choice very limited restaurant staff very remote
## 162                                                                                                                                                              The WIFI connection is not very stable,
## 163                                                                                                                    We had breakfast at the hotel and the food was good and service was good as well.
## 164                                                                                                                                                                        Wifi connection was not good.
## 165                                                                                                                                                         Belgian waffle maker at breakfast was great.
## 166                                                                                                      My daughter and myself enjoyed the food at the restaurant ( located conveniently at the hotel.)
## 167                                                   Very central, room was clean, bar has a great atmosphere, offers a free breakfast in the morning and free tea and coffee in the bar during the day
## 168                                                                                                                       Staff were friendly& helpful, the strong wifi,more food choices for breakfast!
## 169                                                                                                                                                                         Location, clean common areas
## 170                                                                                                                                                              Hotel was very clean and had character.
## 171                                                                                                                                                                it made for a very expensive holiday.
## 172                                                                                                                                                                                   Unclean bathrooms.
## 173                                                                                                                                                     Hotel was comfortable, clean and great location.
## 174                                                                                                                                                             there was dust and tissue under the bed.
## 175                                                                                                                        I was charged for this hotel even though I canceled 4,days prior to arriving.
## 176                                                                                   Location, evening reception in the Reading Room, friendly and efficient staff, rooftop bar, restaurant downstairs.
## 177                                                    Internet in the room - doesn't matter how the hotel management justifies this, paying for a BASIC amenity like internet these days is ridiculous.
## 178                                                                                                                                                                        The floor was not very clean.
## 179                                                                                                                      We all agreed we would like to see a meat option like sausage at the breakfast.
## 180                                                                                                                                                                even a great rate in NYC isn't cheap!
## 181                                                                                                                                                                      The room itself was very clean.
## 182                                                                                                                                               My room was immaculate and smelled so fresh and clean.
## 183                                                                                                               Super nice staff, very clean , bed was super comfortable , nice view , good location .
## 184                                                                                                                                           But fare to say only of the few hotels with free breakfast
## 185                                                                                                                                            Easy to access breakfast room, guest rooms and elevators.
## 186                                                                                                                                                                           The price is too expensive
## 187                                                                                                                                             Unstable wifi, weak heater, lack of coffee/tea amenities
## 188                                    Breakfast included. Happy hour. Neat and clean upon arrival to room. Coffee available all day with flavored creamers at lobby location. Good location within city
## 189                                                                                                                                                              Continental breakfast quality was poor.
## 190                                                                                                                   Convenient, friendly, service and availability of refreshments throughout the day.
## 191                                                                                                                                               Surely this is against health and safety regulations?.
## 192                                                                                                                                                                                      No fruit salad.
## 193                                                                                  Rooms way to small its just a closet with a bed no room to do anything and staff was not helpful at all wow no good
## 194                                                                                                                                                                                     Foods were nice.
## 195                                                                                                                                                                We didn't like the mouse in the room.
## 196                                                                                                                                                                  location, breakfast, friendly staff
## 197                                                                                                                                                                           Huge beds, friendly staff.
## 198                                                                                                                                                                     Was cold in room, dirty bathroom
## 199                                                                                                 Would recommend to people who are young and do not care too much about most things other than money.
## 200                                                                                                                                          Reasonably priced Italian restaurant off the paneled lobby.
## 201                                                                                                              Facilities are clean, use of the kitchen and fridge was great and the location is good.
## 202                                                                                                                                 Would of expected cooked breakfast and wifi to be included in price.
## 203                                                                                                Felix acknowledged our birthdays with cupcakes and candles and provided us with a room with two beds.
## 204                                                                                                                                                            Nice location, room size and cleanliness.
## 205                                                                                                                                            price of accommodation is over priced for what its worth.
## 206                                                                                                                 LOCATION-safe, family oriented, nearby grocery, restaurants pharmacy, close to sites
## 207                                                                                                                                                                   Very good value at $100 a night !!
## 208                                                                                                      Service with a smile. Although in China town, it is still in Manhattan. Free and not slow wifi.
## 209                                                                                                                                                                    Breakfast not available in Hotel.
## 210                                                                                                                                                                         The wifi didn't always work.
## 211                                                                                             have to check-out at noon next morning, feel really unfair for value we paid and toilet water's pour out
## 212                                                                                                                                         I also enjoyed the complimentary breakfast muffins & coffee.
## 213                                                                                                                     Staff were very polite and friendly. Room was clean and tidy. Excellent location
## 214                                                                                                                                                       Location, staff, good service, clean big rooms
## 215                                                                                                                                                      Room was not cleaned even once during our stay.
## 216                                                                                                                                                Hard to sleep due to the traffic noise on the street.
## 217                                                                                                                                                                                             Bad wifi
## 218                                                                                                                                        The room and location were fine and the price was reasonable.
## 219                                                                                                                                                    Cocktails at the bar were expensive and very poor
## 220                                                                                                            We had no hot water for one week and the hotel was located nearly under Manhattan bridge.
## 221                                                                                                                          The hotel offers a good continental breakfast that offers more than donuts.
## 222                                                                                                                                                  Crumbs from snacks were not cleaned up for 3 days!!
## 223 loved the roof terrace and the area ...the cleaning staff are amazing so polite .... the tea and coffee was good .....but it was sad to see such a beautiful  lounge and rooftop wasted and empty ..
## 224                                                                                                                                               the bathroom was a little dirty with hair at the walls
## 225                                                                                                                                                 Very small room, breakfast had to be eaten standing.
## 226                                                                                                                                            Great location, great helpful stuff, very rich breakfast.
## 227                                                                                                                                      The room was noisy at night from traffic and bars on Amsterdam.
## 228                                                                                                                                                             Too expensive for the breakfast and poor
## 229                                                                                                                                               To have  to pay for wifi  this  is totally outrageous.
## 230                                                                                                                                It was fairly quiet, the staff were friendly and the rooms were clean
## 231                                                                                                                                                        The location was amazing the price was great.
## 232                                                                                                                                                             Very kind employee and clean facilities.
## 233                                                                                                                                     As was d dinner and wine from 5pm to 7pm, which was lovely also.
## 234                                                                                                                                        noisy rooms, no facilities other than one bar cum restaurant.
## 235                                                                                                                                                  They also serve nice coffee and tea on first floor!
## 236                                                                                                                                                                                   Always kept clean.
## 237                                                                                                                  There was also a blood stain on the comforter that definitely did not come from us.
## 238                                                                                                                                                comfortable rooms, good breakfast, good exercise room
## 239                                                                                                                                                                       Great Location / Staff / Value
## 240                                                                                                                                                                          The room floors were dirty.
## 241                                                                                                                                              Found a cheap one on 43rd and 8th for $32 for 24 hours.
## 242                                                                                                          Although management apologized, the other couple were offered the room at half of our rate.
## 243                                                                                                                               The rooms were clean and comfortable and the location was pretty good.
## 244                                                         Location was great. Staff were friendly and helpful. Hotel lobby and room were very clean. Restaurant ( Rare ) had a cool vibe and good food
## 245                                                                                                                                                       Comfort I enjoyed the rooftop bar and lounge .
## 246                                                                                                                                                  Nice staff & location near from any tourism objects
## 247                                                                                                                                                                       Rather dirty (rug, furniture).
## 248                                                                                                                The location is just perfect, the staff are excellent and the hotel spotlessly clean.
## 249                                                                                                         Elevators a problem - took minutes to get one - all staff were using them, making them busy.
## 250                                                                                                                                      Staff was very friendly and the room and hotel were very clean.
## 251                                                                                                                                            Given the size of the rooms I did think it was expensive.
## 252                                                                                                                                      Room was a little older, could use an update and was expensive.
## 253                                                                                                                                                   The construction and street noise were disruptive.
## 254                                                                                                                                                The free wine and cheese was none too shabby, either.
## 255                                                                                                                                            Considering the prices of the drinks this could be added.
## 256                                                                                                                                         I would not think the price is reasonable for the tiny room.
## 257                                                                                                                     No fridge no microwave , made me want to go home to expensive for value of hotel
## 258                                                                                                                         Great value for money and perfect location, with a fine restaurant attached.
## 259                                                                                                                                                                                The Wifi didn't work.
## 260                                                                                                                                  no spotless,did not refresh coffee and tea bags daily, plastic cups
## 261                                                                                                                                                              The Wifi was not free and 15$ per night
## 262                                                                                                                                              clean and staff really try to accommodate requests etc.
## 263                                                                                                                                                           Quite pricey considering where it's based.
## 264                                                                                                                                                                        - room smelled weird at first
## 265                                                                                                                                                          Location, staff, breakfast, evening drinks.
## 266                                                                         noise from subway from Manhattan Bridge (hotel is very close to it; 10 meters maybe);\nwi-fi sometimes was sometimes wasn't)
## 267                                                                                                                                                                                   Long hair in bath.
## 268                                                                                       Though the neighboring area does not look clean, inside the hostel it is very well maintained and super clean.
## 269                                                                                                    Friendly staff, comfortable facility, safe neighborhood in the middle of day and night city life.
## 270                                                                                                                                                                                  Should improve wifi
## 271                                                                               Everything I needed. Cafe was great and reasonable pricing. The elevator system (new to me). I did not eat the donuts.
## 272                                                                                 Staff all amazing from front desk, to bell hop, to bartender at the great penthouse bar with a view of Central Park!
## 273                                                                                                                                                                                           Free wi-fi
## 274                                                                                                                                       not much regarding food or drinks- no one to help with luggage
## 275                                                                                                                                                        Excellent restaurant, good room service menu.
## 276               Location is actually quite convenient ( bus is 24/7 access to most of spotlight of NYC. Staff are quite helpful. Free printing service. Fast/Free wireless. Laundry service is a plus.
## 277                                                                                                        internet was unstable, elevators were too slow, sometimes front desk staff were a little rude
## 278                                                                                                                                                            Internet only worked in part of the room.
## 279                  Location; comfort of bed; clean; quite; opposite zuma restaurant; good internet service (used to be slow before); good selection for breakfast; most of staff are kind & helpful...
## 280                                                                                                                                              The cleanliness of the room was ok. 24hr desk is great.
## 281                                                                                                                                                                                  free WiFi in lobby.
## 282                                                                                                                    I'm an early riser and I would have liked to relax in the lobby with some coffee.
## 283                                                                                                                                                  No breakfast included in a $550 room is ridiculous.
## 284                                                                                                                                                                  Reasonably clean, friendly service.
## 285                                                                                             They have a terrific free wine and cheese each evening, which means meeting the owners and other guests.
## 286                                                                                       Complimentary breakfast - could not find yogurt or fruit others were eating - not really anyone around to ask.
## 287                                                                                                                                                     Elevator was crowded and the wifi signal is weak
## 288                                                                                                                                                              Location and cleanliness are excellent!
## 289                                                                                                                                                             Good value for money and friendly staff.
## 290                                                                                                                Staff were friendly and accommodating, and the wi-fi signal was exceptionally strong!
## 291                                                                                                                        Responsiveness of cleaning staff - toiletries were not replenished regularly.
## 292                                                                                                   The staff were friendly and the facilities were great - wifi, PC and printer, free tea and coffee.
## 293                                                                                                                                             WiFi was not freely available and was at a daily charge.
## 294                                                         I was also overcharged; when ask member of stuff to explain they just blamed their colleague for miscalculation and weren't that apologetic.
## 295                                                             The staff are what make this hotel, especially the waitress who served us breakfast each morning and the waiter on duty in the evenings.
## 296                                                                                                                                      For a 5 star hotel that is a very cheap way to treat customers.
## 297                                                                                                                                                             There are a lot of food around the area.
## 298                                                                                                                                 spotless - clean, modern and staff very friendly and really helpful!
## 299                                                                                                                                                           We found free wifi everywhere else we went
## 300                                         very poor service, extremely unfriendly , arrogant and not helpful, no customer orientation at all, no minibar in room... i had to wait so long to check in.
## 301                                                                                                                                                      Room was so small and they charge me 50 dollar.
## 302                                                                                                                                                            Parking was a problem and very expensive.
## 303                                                 the staircase is a bit old and dusty where works are taking place and scaffolding all over the front of the hotel... like I said, not a massive deal
## 304                                                                                                                                                          You have to pay extra for wifi every 24hrs.
## 305                                                                                                  I got told off at the roof top bar for sitting in the wrong area by the security.The room was tiny.
## 306                                                                                                                                 No WiFi in hotel unless you were prepared to pay well over the odds!
## 307                                                                                                                                                 Nowadays the internet should be for free everywhere.
## 308                                                                                    The old tower has not been overhauled since the 70ies, no ice machine, no free wifi, TV not working properly etc.
## 309                                                                                             Friendly staff, location, blazing fast wifi, printer at business center/lounge, facilities in the rooms.
## 310                                       Everything , Room comfort & cleanliness , Staff members are so friendly and hospitable , location is perfect in the heart of NYC  , 2 min walk from Times Sq !
## 311                                                                                                                                                                        Beds comfy and location good,
## 312                                                                                                                                                                  Quiet, clean, great great location!
## 313                                                                               It's also very close to restaurants, bars and shopping (even though I prefer East or West village to go out at night).
## 314                                                                                                                                                     Staff was very nice....bathrooms were very nice.
## 315                                                                                                                                                                   Complimentary Wi-Fi is also a win.
## 316                                                                                                                                                          The location and the room were exceptional.
## 317                                                                                                                      The rooms are very nice and clean and if you get lucky, you get a amazing view.
## 318                                                                                             Location: 5 minutes from Subway Line 1, 10 minutes from Central Park, variety of restaurants in the area
## 319                                                          Stylish design, nice comfy sofas in lobby next to fireplace, Ely helpful\nfront desk staff, trendy restaurant and bar frequented by locals.
## 320                                                                                                                                The staff was friendly and the complimentary breakfast was excellent!
## 321                                                                                                                                                                              The complimentary WiFi.
## 322                                                                                                                                                                                          Decent wifi
## 323                                                                                                                                                                            internet free at the room
## 324                                                                                                         Great: Bar, great location, big size rooms decent value per money, warm night on NY at -10 C
## 325                                                                                                                                                    There is a Deli a few meters away from the hotel.
## 326                                                                                                                 The room was clean and comfortable and the inclusion of the breakfast was great too.
## 327                                                                                                                                                           Great location and easy room for 3 people.
## 328                                                                                                                                                          Next to Balthazar for a delicious breakfast

Создание модели (обучение и тестирование)

library(caTools)
set.seed(101)
sample <- sample.split(hotel,SplitRatio=0.7)
train <-subset(hotel,sample==T)
# test <- suset(hotel,sample==F)

Построил модель

Установка необходимых пакетов

library(monkeylearn)

Установите среду

Sys.setenv(MONKEYLEARN_KEY ="7a2775f6ea7793ac3abe72662f99ad534796e7bb")

Запуск модели (пример в поле Demo)

Sys.getenv("MONKEYLEARN_KEY")
## [1] "7a2775f6ea7793ac3abe72662f99ad534796e7bb"

Настройка текстов

text1 <- "WIfi not working" 
text2 <- "Ac good working"
text3 <- "Room service is good"
text4 <- "Excellent room service"
text5 <- "dirty room"
texts <- c(text1, text2,text3,text4,text5)

Запрос через API

library(tidyverse)
## -- Attaching packages ----------------------------------------------- tidyverse 1.3.0 --
## v ggplot2 3.3.2     v dplyr   1.0.0
## v tibble  3.0.3     v stringr 1.4.0
## v tidyr   1.1.0     v forcats 0.5.0
## v purrr   0.3.4
## -- Conflicts -------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
monkey_classify(texts,classifier_id ="cl_pi3C7JiL") %>% unnest_wider(res)
## Processing batch 1 of 1 batches: texts 1 to 5
## Warning: `cols` is now required when using unnest().
## Please use `cols = c(res)`
## # A tibble: 5 x 5
##   req                    confidence category_id probability label   
##   <chr>                       <dbl>       <int>       <dbl> <chr>   
## 1 WIfi not working            0.941   122921385       0.941 Negative
## 2 Ac good working             0.894   122921383       0.894 Positive
## 3 Room service is good        0.901   122921383       0.901 Positive
## 4 Excellent room service      0.968   122921383       0.968 Positive
## 5 dirty room                  0.794   122921385       0.794 Negative

Удачного анализа!!😍