Documentation ¶
Index ¶
- Variables
- func FilterArticleURLsBySection(urls []string, section string) []string
- type Article
- type ExtractedBody
- type ExtractedSection
- type Messages
- func (msg *Messages) AddError(message string)
- func (msg *Messages) AddErrorf(format string, args ...interface{})
- func (msg *Messages) AddMessages(context string, other *Messages)
- func (msg *Messages) AddWarning(message string)
- func (msg *Messages) AddWarningf(format string, args ...interface{})
- func (m *Messages) String() string
- type NutritionData
- type ParagraphFragment
- type Photo
- type PhotoInfo
- type Recipe
- type RecipeDuration
- type RecipeExtractionResult
- type RecipeFragment
- type RecipeFragmentTag
- type RecipeImage
- type RecipeIngredient
- type RecipeInstruction
- type RecipeMarkerFragment
- type RecipePhoto
- type RecipeTimingFragment
- type TimeInterval
Constants ¶
This section is empty.
Variables ¶
View Source
var Debugger = lib.NewCondLogger("newsfetch:model:article")
Functions ¶
Types ¶
type Article ¶
type Article struct { Id bson.ObjectId `bson:"_id,omitempty" json:"_id"` ArticleId int `bson:"article_id" json:"article_id"` Headline string `bson:"headline" json:"headline` Subheadline string `bson:"subheadline" json:"subheadline"` Section string `bson:"section" json:"section"` Subsection string `bson:"subsection" json:"subsection"` Sections []string `bson:"sections" json"sections"` Source string `bson:"source" json:"source"` Created_at time.Time `bson:"created_at" json:"created_at"` Updated_at time.Time `bson:"updated_at" json:"updated_at"` Timestamp time.Time `bson:"timestamp" json:"timestamp"` Url string `bson:"url" json:"url"` Photo *Photo `bson:"photo" json:"photo"` BodyText string `bson:"body" json:"body"` Visits []TimeInterval `body:"visits" json:"visits"` }
type ExtractedBody ¶
type ExtractedBody struct { Text string RecipeData RecipeExtractionResult Messages *Messages }
func (*ExtractedBody) String ¶
func (e *ExtractedBody) String() string
type ExtractedSection ¶
TODO only use the Sections array for this, don't have section/subsection distinction
type Messages ¶
func (*Messages) AddMessages ¶
func (*Messages) AddWarning ¶
func (*Messages) AddWarningf ¶
type NutritionData ¶
type NutritionData struct {
Text string `json:"text" bson:"text"`
}
func (NutritionData) AddToRecipe ¶
func (f NutritionData) AddToRecipe(r *Recipe)
func (NutritionData) Mark ¶
func (f NutritionData) Mark(tag RecipeFragmentTag)
func (NutritionData) Tag ¶
func (f NutritionData) Tag() RecipeFragmentTag
type ParagraphFragment ¶
type ParagraphFragment struct { RawHtml string Text string TagF RecipeFragmentTag }
func (ParagraphFragment) AddToRecipe ¶
func (f ParagraphFragment) AddToRecipe(r *Recipe)
func (*ParagraphFragment) Mark ¶
func (f *ParagraphFragment) Mark(tag RecipeFragmentTag)
func (ParagraphFragment) Tag ¶
func (f ParagraphFragment) Tag() RecipeFragmentTag
type Recipe ¶
type Recipe struct { Id bson.ObjectId `json:"_id" bson:"_id,omitempty"` ArticleId int `json:"article_id" bson:"article_id,omitempty"` Url string `json:"url" bson:"url,omitempty"` Title string `json:"title" bson:"title"` Photo *RecipePhoto `json:"photo" bson:"photo,omitempty"` ServingSize string `json:"serving_size" bson:"serving_size,omitempty"` PreparationTime *RecipeDuration `json:"prep_time" bson:"prep_time,omitempty"` TotalTime *RecipeDuration `json:"total_time" bson:"total_time,omitempty"` Ingredients []RecipeIngredient `json:"ingredients" bson:"ingredients"` Instructions []RecipeInstruction `json:"instructions" bson:"instructions"` Nutrition *NutritionData `json:"nutrition" bson:"nutrition,omitempty"` }
func (Recipe) PlainLines ¶
type RecipeDuration ¶
type RecipeDuration struct {
Text string `json:"text" bson:"text"`
}
type RecipeExtractionResult ¶
type RecipeExtractionResult struct { Recipes []*Recipe UnusedParagraphs []RecipeFragment EmbeddedArticleUrls []string }
type RecipeFragment ¶
type RecipeFragment interface { Tag() RecipeFragmentTag Mark(tag RecipeFragmentTag) AddToRecipe(recipe *Recipe) }
type RecipeFragmentTag ¶
type RecipeFragmentTag int
const ( NoTag RecipeFragmentTag = iota TitleTag PossibleTitleTag ParagraphTag ShortParagraphTag // paragraph that might as well be an ingredient InstructionTag IngredientsSubtitleTag DirectionsSubtitleTag PossibleIngredientSubdivisionTag // normal paragraph unless proven otherwise TimingTag ServingSizeAltTimingTag // “This recipe serves ...”, found in the body of the article IngredientTag IngredientSubdivisionTag PossibleIngredientTag NutritionDataTag SignatureTag CopyrightTag EndMarkerTag )
type RecipeImage ¶
type RecipeImage struct {
Url string `json:"url" bson:"url"`
}
type RecipeIngredient ¶
type RecipeIngredient struct {
Text string `json:"text" bson:"text"`
}
type RecipeInstruction ¶
type RecipeMarkerFragment ¶
type RecipeMarkerFragment struct {
TagF RecipeFragmentTag
}
func (RecipeMarkerFragment) AddToRecipe ¶
func (f RecipeMarkerFragment) AddToRecipe(recipe *Recipe)
func (RecipeMarkerFragment) Mark ¶
func (f RecipeMarkerFragment) Mark(tag RecipeFragmentTag)
func (RecipeMarkerFragment) Tag ¶
func (f RecipeMarkerFragment) Tag() RecipeFragmentTag
type RecipePhoto ¶
type RecipePhoto struct { FullSizeImage *RecipeImage `json:"full" bson:"full,omitempty"` SmallImage *RecipeImage `json:"small" bson:"small,omitempty"` }
type RecipeTimingFragment ¶
type RecipeTimingFragment struct { TagF RecipeFragmentTag ServingSize string PreparationTime *RecipeDuration TotalTime *RecipeDuration }
func (RecipeTimingFragment) AddToRecipe ¶
func (f RecipeTimingFragment) AddToRecipe(r *Recipe)
func (RecipeTimingFragment) Mark ¶
func (f RecipeTimingFragment) Mark(tag RecipeFragmentTag)
func (RecipeTimingFragment) Tag ¶
func (f RecipeTimingFragment) Tag() RecipeFragmentTag
type TimeInterval ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.