mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-06-13 14:48:54 +02:00
94ff4caea8
Topic Social Proof Service (TSPS) delivers highly relevant topics tailored to a user's interests by analyzing topic preferences, such as following or unfollowing, and employing semantic annotations and other machine learning models.
31 lines
1.1 KiB
Scala
31 lines
1.1 KiB
Scala
package com.twitter.tsp.stores
|
|
|
|
import com.twitter.storehaus.ReadableStore
|
|
import com.twitter.topiclisting.FollowableTopicProductId
|
|
import com.twitter.topiclisting.ProductId
|
|
import com.twitter.topiclisting.SemanticCoreEntityId
|
|
import com.twitter.topiclisting.TopicListingViewerContext
|
|
import com.twitter.topiclisting.utt.UttLocalization
|
|
import com.twitter.util.Future
|
|
|
|
case class LocalizedUttTopicNameRequest(
|
|
productId: ProductId.Value,
|
|
viewerContext: TopicListingViewerContext,
|
|
enableInternationalTopics: Boolean)
|
|
|
|
class LocalizedUttRecommendableTopicsStore(uttLocalization: UttLocalization)
|
|
extends ReadableStore[LocalizedUttTopicNameRequest, Set[SemanticCoreEntityId]] {
|
|
|
|
override def get(
|
|
request: LocalizedUttTopicNameRequest
|
|
): Future[Option[Set[SemanticCoreEntityId]]] = {
|
|
uttLocalization
|
|
.getRecommendableTopics(
|
|
productId = request.productId,
|
|
viewerContext = request.viewerContext,
|
|
enableInternationalTopics = request.enableInternationalTopics,
|
|
followableTopicProductId = FollowableTopicProductId.AllFollowable
|
|
).map { response => Some(response) }
|
|
}
|
|
}
|